Reputation: 57
using jQuery version 2.1.1,i am disabling the the drop-down control on page load , on first drop-down change i need to enable second drop-down. disabling is working fine on page load.. but i cant enable it back on change event in jQuery.. i tried the following
$("#mRFFacility").change(function () {
$("#mRFWorkspace").prop('disabled', false);
$('#mRFWorkspace').removeAttr('disabled');
});
kindly help me to resolve this issue
Upvotes: 0
Views: 282
Reputation: 1153
Here is some working code with the desired behaviour. Compare it to what you have and see why it isn't working for you. The part of your code that you have provided looks fine, but you only need remove the disabled attribute as shown below.
$("#mRFWorkspace").prop('disabled', 'disabled');
$("#mRFFacility").change(function () {
$('#mRFWorkspace').removeAttr('disabled');
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<select id="mRFFacility">
<option value="0">Facility A</option>
<option value="1">Facility B</option>
</select>
<br/>
<select id="mRFWorkspace">
<option value="0">Workspace A</option>
<option value="1">Workspace B</option>
</select>
Upvotes: 1