Range & select

by jmcjc5u

HTML

<h1 style="text-align:center"> Range & Select </h1>
<hr>
<p>
Your favorite car...
<select id='cars'>
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="opel">Opel</option>
  <option value="audi">Audi</option>
</select>
</p>
<br>

<p>
Input/range: available since HTML5 
(<a href="http://www.w3schools.com/jsref/dom_obj_range.asp">reference</a>)
</p>
<br>
<input type=range min=-20 max=20 id='speed'> speed <br>
<button id='test'>set speed
</button>
<!------------------------------------------------------------------->
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>

JavaScript

$('#cars').change( function() {
	console.log ( $(this).val() );
});

$('#speed').change( function() {
	console.log ( $(this).val() );
});
$('#test').click ( function() {
 $('#speed').val(15);
})