Disable Drop Down Option using jQuery

前端 未结 7 745
时光取名叫无心
时光取名叫无心 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 07:53

    Here i have done solution for above query. demo link as below:

    Demo: http://codebins.com/bin/4ldqp92

    HTML:

     
    
    
    

    JQuery:

    $(function() {
        $("select").click(function() {
            $(this).find("option[value*='Sold Out']").prop("disabled", true);
        });
    });
    

    Demo: http://codebins.com/bin/4ldqp92

提交回复
热议问题