jQuery : How To Get Checked Check Box Value By jQuery

Posted by Ankur in jQuery



Hello Friends, I am always sharing things which i have learnt while doing programming and yesterday when i was making one wordpress plugin which save all options in admin by jQuery Ajax , at that time I was getting one problem in taking checked value of checkbox by jquery. I have searched on internet for solution of this problem but didn’t find that,Finally i posts this problem in one PHP forum thread and i got one reply from one member of that forums for solution of this problem and I used that solution an it worked very well, So I thought to share that solution.

If you want to take value of Checked Checkbox Value by jquery then below is the code for it.

var checkbox_value = $('#check_box_id:checked').val();

In Above code check_box_id is id value of check box. Just use this code and replace your check box id with check_box_id , you will get check box value if ticked in checkbox_value variable.

Let me know if you have any other method to get checkbox values by jquery.

You can follow any responses to this entry through the RSS 2.0 You can leave a response, or trackback.

  • Anees

    Thanks for sharing this tip my friend

    Well done n Keep it up
    Regards
    Anees

  • http://www.hackingethics.com/ Ankur Gandhi

    Thanks Anees.

  • developer in php

    guys , with your example i got my perfect ..
    thank you.!!

  • priyanka

    thanks,

    it easy to get value of checkbox directly in single line

Get Adobe Flash player