How To Pass A Php Variable From A Dropdown To Another Dropdown Using Php? October 31, 2022 Post a Comment ).on("change", function(){ var selectedClass = $(this).val(); //store the selected value $('#select2').val(""); //clear the second dropdown selected value //now loop through the 2nd dropdown, hide the unwanted options $('#select2 option').each(function () { var newValue = $(this).attr('class'); if (selectedClass != newValue && selectedClass != "") { $(this).hide(); } else{$(this).show(); } }); }); });Copy <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script> <select id="select1"> <option value=""></option> <option value="number1">number 1</option> <option value="number2">number 2</option> </select> <select id="select2"> <option class=""></option> <option class="number1">number 1.1</option> <option class="number2">number 2.1</option> <option class="number1">number 1.2</option> <option class="number2">number 2.3</option> <option class="number1">number 1.3</option> <option class="number1">number 1.2</option> </select>Copy Share You may like these postsJavascript Collision Detection System Don't Ignore Blocked CollisionsJquery If With Multiple Value Show And Hide ElementJquery Toggle Left To Right AnimationVisual Counter Relative To Scroll Position On Page
Post a Comment for "How To Pass A Php Variable From A Dropdown To Another Dropdown Using Php?"