How To Pass A Php Variable From A Dropdown To Another Dropdown Using Php? May 18, 2024 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<scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script><selectid="select1"><optionvalue=""></option><optionvalue="number1">number 1</option><optionvalue="number2">number 2</option></select><selectid="select2"><optionclass=""></option><optionclass="number1">number 1.1</option><optionclass="number2">number 2.1</option><optionclass="number1">number 1.2</option><optionclass="number2">number 2.3</option><optionclass="number1">number 1.3</option><optionclass="number1">number 1.2</option></select>Copy Share You may like these postsDrop Down Menu For Selecting Country Then StatesHow To Display Multiple List Of Checkboxes Dynamically On Dropdown ListHow To Check If An Item Is Selected From An Html Drop Down List?Dropdown Menu Css / Js On Ipad
Post a Comment for "How To Pass A Php Variable From A Dropdown To Another Dropdown Using Php?"