Reputation: 279
in firefox, when i click option, firefox regards select be clicked too. e.stoppropgation() or e.preventdefault() can not solve this problem. is it possible to stop option click event just like in chrome? Thanks for your idea.
<select>
<option>test</option>
</select>
<p>adfadf</p>
$(document).ready(function(){
$("select").click(function(){$("p").toggle();})
$("select option").click(function(){alert('it is weired');})
})
Upvotes: 2
Views: 1933
Reputation: 31033
$("select").click(function(){
console.log('select');
$("p").toggle();
});
$("select option").click(function(e){
e.stopPropagation();
console.log('it is not weired');
});
Upvotes: 2
Reputation: 42040
"click" is not the proper event for select
elements. You should use change
instead.
Upvotes: 1
Reputation: 15922
Don't use click event. Use change event. Firefox is doing right, you are clicking select box.
Upvotes: 1