jquery selected selector
Translation results:
selected
UK[sɪ'lektɪd] US[sɪ'lektɪd]
adj.Selected, chosen
v. Choose, pick (past tense and past participle of select)
jquery selected selectorsyntax
Function::selected selector selects the selected <option> element.
Syntax: $(":selected")
Comments: This selector does not apply to radio buttons or check boxes frame. Please use :checked instead.
jquery selected selectorexample
<html> <head> <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $(".btn1").click(function(){ $(":selected").hide(); }); }); </script> </head> <body> <select multiple="multiple"> <option>Volvo</option> <option selected="selected">Saab</option> <option>Mercedes</option> <option>Audi</option> </select> <br /> <button class="btn1">Hide Selected</button> </body> </html>
Click the "Run instance" button to view the online instance