Disable select options based on value *through the HTML only!*

With your current markup this will work:

$("select option:contains('Value b')").attr("disabled","disabled");

http://jsfiddle.net/CtqC6/

EDIT

http://jsfiddle.net/CtqC6/1/

var variable = "b"
$("select option:contains('Value " + variable + "')").attr("disabled","disabled");
$("select").prop("selectedIndex",-1)

Leave a Comment