Handle non native select clicked event
Description
The following code shows how to handle non native select clicked event.
Example
<!-- w w w .j a v a 2 s. c o m-->
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.7.1.js'></script>
<link rel="stylesheet" type="text/css"
href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css">
<script type='text/javascript'
src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script>
</head>
<body>
<div data-role="page" id="the-page">
<div data-role="content">
<select data-native-menu="false" id="the-select">
<option value="a">a</option>
<option value="b">b</option>
</select>
</div>
</div>
<script type='text/javascript'>
$('#the-select').on('change', function () {
var $this = $(this),
val = $this.val();
alert('onChange = ' + val);
});
$('#the-page').on('click', '.ui-selectmenu-list > li', function () {
alert('onClick = ' + $('#the-select').children().eq($(this).attr('data-option-index')).val());
});
</script>
</body>
</html>