Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determine if Checkbox is Checked using jQuery [duplicate]

Tags:

Possible Duplicate:
Check checkbox checked property using jQuery

What is the correct way of accessing a checkbox to check if it's checked? Is it necessary to first check if that element exists in the DOM and then see if is checked or not?

like image 846
Hommer Smith Avatar asked Oct 31 '12 19:10

Hommer Smith


1 Answers

You would use the checked selector along with the is method of Jquery

if($('#chkbox').is(':checked')){  } 
like image 85
Pastor Bones Avatar answered Oct 22 '22 16:10

Pastor Bones