Here I am explaining how to remove an option from selectbox or combobox options list using Jquery. Jquery is a powerful javascript library that provides a lot of predefined functions to achieve our needs.
For removing the option, using remove function(remove()).
Add following script in onload function.
$("#selectboxid option[value='value']").remove();
selectboxid = ID of your selectbox
value = value of the option which you want to remove.
$(document).ready(function()){
$("#select-id option[value='0']").remove();
});
Here option value 0 is removed while the form load.
http://api.jquery.com/remove/
For removing the option, using remove function(remove()).
Add following script in onload function.
$("#selectboxid option[value='value']").remove();
selectboxid = ID of your selectbox
value = value of the option which you want to remove.
$(document).ready(function()){
$("#select-id option[value='0']").remove();
});
Here option value 0 is removed while the form load.
http://api.jquery.com/remove/
0 comments:
Post a Comment