Answers for "select method in jquery"

3

jquery select on select

$('select').on('change', function(e) {
  console.log( e.target.value );
});
Posted by: Guest on July-02-2021
0

select method in jquery

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>selected demo</title>
  <style>
  div {
    color: red;
  }
  </style>
  <script src="https://code.jquery.com/jquery-3.5.0.js"></script>
</head>
<body>
 
<select name="garden" multiple="multiple">
  <option>Flowers</option>
  <option selected="selected">Shrubs</option>
  <option>Trees</option>
  <option selected="selected">Bushes</option>
  <option>Grass</option>
  <option>Dirt</option>
</select>
<div></div>
 
<script>
$( "select" )
  .change(function() {
    var str = "";
    $( "select option:selected" ).each(function() {
      str += $( this ).text() + " ";
    });
    $( "div" ).text( str );
  })
  .trigger( "change" );
</script>
 
</body>
</html>
Posted by: Guest on June-10-2021
1

jquery select

$('#selector').selectmenu();
Posted by: Guest on February-05-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language