jquery - Html checkBox onchange not working -


<input class="jproblemclass" id="checkbox{%= id %}" type="checkbox" onchange="problempicker.onchangeproblemcheckbox('{%=id %}');"/> 

after first check or uncheck nothing happens. afetr second click, call function problempicker.onchangeproblemcheckbox, id first check. why? can me anybody?

onchangeproblemcheckbox: function(id) {     if ($('#checkbox' + id).attr("checked") == true) {         problempicker.addtocheckproblems(id);          var checkboxes = $('.jproblemclass:checked');          if ((checkboxes.length > general.limit) && (general.limit != 0)) {             alert('the limit of ' + general.limit + ' problems exceeded. please deselect ' + (checkboxes.length - general.limit).tostring() + '.');         }     } else {         problempicker.delfromcheckproblems(id);     } }, 

bro use onclick event instead onchange.. reason... according javascript references i've read, onchange fires after focus lost. unless click somewhere else, focus not lost in ie. other browsers must not waiting focus lost before firing onchange - suggest not following spec correctly (despite making more sense fire @ point). how using onclick , onkeydown/onkeyup instead (by using both onclick , onkeyup/onkeydown cover both mouse , keyboard setting of checkbox). reference : http://www.winvistatips.com/re-onchange-event-checkbox-not-working-properly-t311364.html


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -