How do I put text in a drop down list?
We can select text or we can also find the position of a text in a drop down list using option:selected attribute or by using val() method in jQuery. By using val() method : Syntax : $(selector).val(parameter)Parameter : parameter is optional. Example :
The selected value: Output : After click on the button. By using option:selected : Syntax : $("#selector option:selected");Parameter : No parameter required. Example :
The selected value: Output : After click on the button. jQuery is an open source JavaScript library that simplifies the interactions between an HTML/CSS document, It is widely famous with its philosophy of Write less, do more.
Article Tags :
JQuery Web Technologies
jQuery-Misc |