JQ adds a click event to the option of select

when we use the select drop-down list box, we need to select the selected < option> Option triggers an event, in fact < option> There is no event method itself, we only fire in the onChange method in the SELECT.

wants to add an option trigger event, but adding onclick to the option does not trigger the event

add onclick in the select.

solution: add a change to the select event can

< select id=”sumyear” >
< option grade=”0″ value=”a” > Please select year & LT; /option>
< option grade=”1″ value=”b” > 2018< /option>
< option grade=”2″ value=”c” > 2019< /option>

< /select>

$(“#sumyear”).change(function(){
alert($(this).children(‘option:selected’).val());
})

Read More: