I want to trigger function when I press an option in the select element. I thought that .click() would be preferable but the thing is, it is executing too fast, so much that it is not allowing me to choose the option from the select. Instead, it's taking the first option's value when I open the drop down list. Could someone suggest me a method of handling this?
HTML:
<select name="year2" id="year1" style="width:200px;">
<option value="none"> none </option>
<option value="2015"> 2015 </option>
<option value="2014"> 2014 </option>
<option value="2013"> 2013 </option>
</select>
JavaScript:
$( "#year1" ).click(function() {
var year=$("#year1").val();
var stream=$("#stream").val();
$.ajax({
url:"checkonserver.jsp",