Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE HTML> <html> <head> <title> JQuery | Remove options from select. </title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"> </script> </head> <body style="text-align:center;" id="body"> <select> <option value="javascript"> Javacript book</option> <option value="css"> Css book</option> <option value="git"> Git book</option> <option value="html"> Html book</option> </select> <button> Remove </button> <script> $('button').on('click', function() { $("option[value='css']").remove(); }); $('button').on('click', function() { $('option[value="javascript"]').remove(); }); </script> </body> </html>