Disable Drop Down Option Using Jquery May 25, 2023 Post a Comment 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 ).prop('disabled',true); Copy Demo According to edit $('#previous_select').on('change', function() { // after creating the option // try following $("select option[value*='Sold Out']").prop('disabled',true); }); Copy Solution 2: 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'); Copy or $("#field_0_1 option[value='- Sold Out -']").prop('disabled','disabled'); Copy working image Solution 3: function lockDownDropDownList(ddlName) { ddlName = "#" + ddlName; var chosenValue = $(ddlName).val(); var downDownListItems = $(ddlName).children('option').map(function (i, e) { return e.value || e.innerText; }).get(); downDownListItems.forEach(function (item) { if (item != chosenValue) { $("select option[value*='" + item + "']").prop('disabled', true); } }); } Copy Solution 4: Here i have done solution for above query. demo link as below: Demo: http://codebins.com/bin/4ldqp92 HTML: <select id="field_0_1" class="text_select" name="field_0_1" onChange=""> <option value=""> - Preferred Time - </option> <option value="- Sold Out -"> - Sold Out - </option> <option value="2:30 - 4:00pm"> 2:30 - 4:00pm </option> </select> <select id="field_0_2" class="text_select" name="field_0_2" onChange=""> <option value=""> - Preferred Time - </option> <option value="- Sold Out -"> - Sold Out - </option> <option value="2:30 - 4:00pm"> 2:30 - 4:00pm </option> </select> <select id="field_0_3" class="text_select" name="field_0_3" onChange=""> <option value=""> - Preferred Time - </option> <option value="- Sold Out -"> - Sold Out - </option> <option value="2:30 - 4:00pm"> 2:30 - 4:00pm </option> </select> Copy JQuery: $(function() { $("select").click(function() { $(this).find("option[value*='Sold Out']").prop("disabled", true); }); }); Copy Demo: http://codebins.com/bin/4ldqp92 Solution 5: $("#ddlList option[value='jquery']").attr("disabled","disabled"); Copy Share Post a Comment for "Disable Drop Down Option Using Jquery" Top Question Input Type Datetime-local Is Not Working In Firefox I have an input type of datetime-local which is working fin… Google Org Chart Data Overflow Outside Of Div I'm using Google Org chart for a project and the conten… Using Bootstrap 4 Flexbox To Equally Divide Four Charts I am trying to plot four different stacked charts in one br… CSS Lighten Child Elements On Parent Mouseover here is my problem. I have a div which contains two other d… Div Is Shown In Wrong Position I have such code: Solution 1: Add margin: 0 auto … Some Weird Thing With Clear Both Via Css Pseudo :after Examine this code: HTML Sometext over here CSS .one { di… Disable Drop Down Option Using Jquery I need to disable options with value '- Sold Out -'… Element On Top Of Parent's Sibling I am trying to get an element to appear on top of its paren… Div Centering CSS I am struggling with my website, I am trying to get the div… Flex-box Only Display As Many Items That Fit In A Container I want to only use CSS to make it so I have a container whi… December 2024 (1) November 2024 (37) October 2024 (69) September 2024 (20) August 2024 (358) July 2024 (338) June 2024 (679) May 2024 (1294) April 2024 (687) March 2024 (758) February 2024 (840) January 2024 (759) December 2023 (809) November 2023 (367) October 2023 (556) September 2023 (291) August 2023 (325) July 2023 (276) June 2023 (346) May 2023 (212) April 2023 (139) March 2023 (143) February 2023 (174) January 2023 (255) December 2022 (121) November 2022 (228) October 2022 (809) September 2022 (164) August 2022 (289) July 2022 (93) Menu Halaman Statis Beranda © 2022 - Html5 Tutorial