0
$('#SaveCheckbox').attr('checked') != true

Intending to check the value of CheckBox by the above means , as found the solution , but its giving false always , either i check the checkbox or uncheck it. Kindly help. I am using jquery-1.10.2.min.js and jquery.mobile-1.4.0.min.js libraries.

Learner
  • 800
  • 1
  • 12
  • 34
  • possible duplicate of [JQuery Mobile refreshing checkbox works only once - .checkboxradio('refresh') issue](http://stackoverflow.com/questions/17612806/jquery-mobile-refreshing-checkbox-works-only-once-checkboxradiorefresh-is) – Omar Apr 16 '14 at 10:07

1 Answers1

0

Use prop() instead of attr()

$('#SaveCheckbox').prop ('checked') != true

As of jQuery 1.6, the .attr() method returns undefined for attributes that have not been set. To retrieve and change DOM properties such as the checked, selected, or disabled state of form elements, use the .prop() method, jQuery Docs

You can also use :checked

if($('#SaveCheckbox').is(":checked"))

OR

if($('#SaveCheckbox:checked').length)
Adil
  • 146,340
  • 25
  • 209
  • 204