Pages

JQuery Get user selected value from select list?

Saturday, 28 December 2013


JQuery Get user selected value from select list?

jQuery is a Javascript framework.Using jQuery removes a lot of cross browser compatibility issues.

<script>
function displayVals() {
  var singleValues = $( "#single" ).val();
  alert(singleValues);
  $( "p" ).html( "<b>Single:</b> " + singleValues );
}

$( "select" ).change( displayVals );
displayVals();
</script>

<select id="single">
  <option>Single</option>
  <option>Single2</option>
</select>

 

Most Reading