I want to prevent a select box from being changed if a certain condition applies. Doing this doesn\'t seem to work:
$(\'#my_select\').bind(\'change\', funct
Try this:
http://jsfiddle.net/qk2Pc/
var my_condition = true; var lastSel = $("#my_select option:selected"); $("#my_select").change(function(){ if(my_condition) { lastSel.prop("selected", true); } }); $("#my_select").click(function(){ lastSel = $("#my_select option:selected"); });