jquery selected selector syntax

jquery selected selector syntax

Action: : Selected selector to select the selected <option> element.

Syntax: $ ( ": the Selected")

NOTE: This does not apply to the selector radio buttons or check boxes. Use: checked instead. Shenzhen dd motor

jquery selected sample selector

<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>

Guess you like

Origin www.cnblogs.com/furuihua/p/11949952.html