admin管理员组文章数量:1323714
I am having an issue with a jquery function. It works in FF but not in IE 6. I want the function to be triggered when any option inside a select drop down is clicked. Here is the start of my funcation:
$('#titleSelect option').click( function() {
alert("title clicked");
......
});
Here is my drop down list:
<select id="titleSelect">
<option></option>
<option>1</option>
<option>2</option>
<option>3</option>
</select>
So in FF, the alert is triggered but in IE it is not. Is there any sort of an issue with IE recognizing the click event on a select and if so is there any way around it.
I am having an issue with a jquery function. It works in FF but not in IE 6. I want the function to be triggered when any option inside a select drop down is clicked. Here is the start of my funcation:
$('#titleSelect option').click( function() {
alert("title clicked");
......
});
Here is my drop down list:
<select id="titleSelect">
<option></option>
<option>1</option>
<option>2</option>
<option>3</option>
</select>
So in FF, the alert is triggered but in IE it is not. Is there any sort of an issue with IE recognizing the click event on a select and if so is there any way around it.
Share Improve this question asked Sep 28, 2009 at 12:34 CarolineCaroline 9693 gold badges17 silver badges22 bronze badges2 Answers
Reset to default 4why you don't use the onChange event? like:
$('#titleSelect').change( function() {
alert("title "+$(this).val()+" clicked");
......
});
the jQuery change-event documentation you can find here:
http://docs.jquery./Events/change#fn
If you look at this page, go to the bottom, the Applies To section, and you can see that the option element is not in the list.
http://msdn.microsoft./en-us/library/ms536913%28VS.85%29.aspx
If you really want an event on the option element then look at the events on this page (click on the word events in the table): http://msdn.microsoft./en-us/library/ms535877%28VS.85%29.aspx#
Otherwise, just react to the onchange event on the select element and you will know when something is changed, but, that means that if they click on the event that was already selected then no event will fire.
本文标签: javascriptJqueryissue with click event on Select dropdowin in IE6Stack Overflow
版权声明:本文标题:javascript - Jquery - issue with click event on Select dropdowin in IE6 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742126403a2421962.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论