checkbox - Jquery Swap checked disabled attr on change -


suppose check disable selected checkbox , reverse check disable on other box. seems work till try again on changed checkbox. brain fried today. grateful insight or better code.

http://jsfiddle.net/sz7r4/

$('.changecheck').change(function(event) {     var oldtarget = $(':checked').attr('id');     console.log(oldtarget);     $(this).attr('disabled', 'disabled').attr('checked', 'checked');     $('#'+oldtarget).removeattr('checked', 'checked').removeattr('disabled', 'disabled'); }); 

currently target second input, need target change event on first input. should use prop() instead of attr():

$('.changecheck, #check1').change(function(event) {      $(this).prop("disabled", true).siblings().prop("disabled", false).prop('checked', false); }); 

updated fiddle


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -