drgullin / icheck

Highly customizable checkboxes and radio buttons (jQuery & Zepto)
http://fronteed.com/iCheck
7.38k stars 1.62k forks source link

Get current state #175

Closed it-can closed 10 years ago

it-can commented 10 years ago

Hi,

Is there a way to get the current state of an iCheck checkbox/radio?

I have a submit button but that checks a couple of checkboxes before posting the form... It seems that $('.terms').prop('checked') is not working...

robertdodd commented 10 years ago

Calling $('.my-checkbox').prop('checked') returns the correct value for me, but it only works for checkboxes and also depends on your jquery version.

jQuery 1.6+

$('#isAgeSelected').prop('checked')

jQuery 1.5 and below

$('#isAgeSelected').attr('checked')

All credit to: http://stackoverflow.com/a/426276/443427

Does that help?

it-can commented 10 years ago

thanks!