[javascript] jquery select option click handler


<select id="mySelect">

Using the select id, how can I trigger a click event on one of the options? I tried attaching the event directly to the select, but this triggers an event whenever the select is clicked on (even if there are no options). Oh, and it is a multi-select (although I don't think that matter).

This question is related to javascript jquery html

The answer is

You want the 'change' event handler, instead of 'click'.

    var value = $(this).val();

Similar questions with javascript tag:

Similar questions with jquery tag:

Similar questions with html tag: