Justhollar
New Member
I have this HTML select code:\[code\]?<select name="loc_code"> <option value="">Select</option> <option value="http://stackoverflow.com/questions/13829293/loc1">Loc1 status ON</option> <option value="http://stackoverflow.com/questions/13829293/loc2">Loc2 status ON</option> <option value="http://stackoverflow.com/questions/13829293/loc3">Loc3 status OFF</option> <option value="http://stackoverflow.com/questions/13829293/loc4">Loc4 status ON</option></select>????????????????????????????????????????????????\[/code\]So, I have a problem disabling option drop downs based on the text name not by value. I need to disable only options that contains status OFF.I tried to modify this jQuery code from other posted similar questions on StackOverflow, but obviously it is wrong:\[code\]$("select[name="loc_code"] option:selected").text(function() { var $thisOption = $(this); var valueToCompare = "OFF"; if($thisOption.val() == valueToCompare) { $thisOption.attr("disabled", "disabled"); }});?\[/code\]Any help is greatly appreciated.