Disable Drop Down Option using jQuery

前端 未结 7 705
时光取名叫无心
时光取名叫无心 2021-01-04 07:35

I need to disable options with value \"- Sold Out -\" in a list of dynamic drop down menus. How can I do this easily with jQuery? Below is the HTML



        
相关标签:
7条回答
  • 2021-01-04 08:04

    Working demo http://jsfiddle.net/BYkVW/ or http://jsfiddle.net/BYkVW/1/

    Hope it helps the needs :)

    code

    $("#field_0_1 option[value='- Sold Out -']").attr('disabled','disabled');
            ​
    

    or

    $("#field_0_1 option[value='- Sold Out -']").prop('disabled','disabled');
    

    working image

    enter image description here

    0 讨论(0)
提交回复
热议问题