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

前端 未结 4 671
囚心锁ツ
囚心锁ツ 2020-12-09 16:41

I need to disable a select option based on the value of a variable. The value is similar to one of the select option value and it needs to be disabled.

For ex,

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-09 17:17

    $("select option[value='"+ $variable + "']").attr('disabled', true); 
    

提交回复
热议问题