JQuery - problem with click event on Select dropdowin in IE6

I have a problem with jquery function. It works in FF, but not in IE 6. I want the function to run when I click on any option inside the selection. Here is the beginning of my function:

$('#titleSelect option').click( function() {    
    alert("title clicked");
    ......
});

Here is my dropdown list:

<select id="titleSelect">
<option></option>
<option>1</option>
<option>2</option>
<option>3</option>
</select>

So, in FF, a warning is triggered, but in IE it is not. Is there some kind of problem with IE that recognizes the click event when it is selected, and if so, there is one around it.

+3
source share
2 answers

why don't you use the onChange event? as:

$('#titleSelect').change( function() {    
alert("title "+$(this).val()+" clicked");
......
});

You can find documentation on changing jQuery events here:

http://docs.jquery.com/Events/change#fn

+4
source

Source: https://habr.com/ru/post/1718702/


All Articles