KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to attempt to disable an option if it is selected in any of the selects So for example if name="select1" has selected option "Test 2", then I want "Test 2" to be disabled in both select statements... and if something else gets checked that it re-enables the previous option. I have written a sample script here to which I thought would get me 'close'... but it's put me far off base here. Any help would be appreciated. <script type="text/javascript"> $(document).ready(function(){ $("select").change(function() { $("select").find("option:selected").attr('disabled', true); }); }); </script> <select name="select1"> <option>No Match</option> <option value="1">Test</option> <option value="2">Test 2</option> <option value="3">Test 3</option> </select> <select name="select2"> <option>No Match</option> <option value="1">Test</option> <option value="2">Test 2</option> <option value="3">Test 3</option> </select>
Tags (comma-separated)
Save Edits
Cancel