javascript - On Check one input gets disabled and the other gets enabled -


i'm coding form gets value search process .. i'm coding 2 text fields user give input on 1 of them.but 1 of them enable @ time .. user can chose option checking check box. default 1 of field should b enable, when check-box checked it(the 1 enable) gets disabled , other gets enabled, , vice versa when check-box unchecked.

here is fiddle:

http://jsfiddle.net/awbvq/224/

this fix problem

html :

<input type="text" name="" /> <input type="checkbox" name="" /> <input type="text" name="" disabled="'disabled'"/> 

js :

$(':checkbox').change(function(){     if ($(this).is(':checked')) {         $(this).prev().attr('disabled','disabled');          $(this).next().removeattr('disabled');     } else {         $(this).next().attr('disabled','disabled');         $(this).prev().removeattr('disabled');      } }); 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -