Set select menu value via Javascript
Description
The following code shows how to set select menu value via Javascript.
Example
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.9.1.js'></script>
<script type="text/javascript"
src="http://code.jquery.com/mobile/1.3.0-beta.1/jquery.mobile-1.3.0-beta.1.js"></script>
<link rel="stylesheet" type="text/css"
href="http://code.jquery.com/mobile/1.3.0-beta.1/jquery.mobile-1.3.0-beta.1.css">
<script type='text/javascript'>//<![CDATA[
$(window).load(function(){<!--from w w w.j a v a 2 s .c o m-->
$(document).ready(function() {
$('#rstBtn').on('click', function() {
$('#dmep').val(0).selectmenu('refresh',true);
});
});
});//]]>
</script>
</head>
<body>
<input type='submit' value='reset' id='rstBtn' data-theme='a' />
<div data-role="fieldcontain" class='seltype' id='xmep'>
<select id="dmep" data-mini='true'>
<option selected value="0">--Units--</option>
<option value='0.0'>A</option>
<option value='0.01'>B</option>
<option value='1'>C</option>
<option value='0.1'>D</option>
<option value='10'>E</option>
<option value='0.'>F</option>
<option value='4.'>G</option>
<option value='7.'>H</option>
</select>
</div>
</body>
</html>