Side navigation
#4950 closed feature (patchwelcome)
Opened July 22, 2009 11:14PM UTC
Closed November 11, 2010 02:36AM UTC
.click(function(){} on option error in IE
Reported by: | Dale | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.4 |
Component: | event | Version: | 1.3.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I found an internet explorer bug when performing an onclick function on an <option>
I have code like thus:
var $dropSelectMainCurrent = $('<select></select>').attr('id','dropSelectMainListCurrent');
var $mainListItems2 = $('.linksNameMain_0');
var $mainSelectListValues2 = new Array();
var $mainSelectList2 = new Array();
for (var i=0; i<$mainListItems2.length;i++)
{
$mainSelectListValues2[i] = $($mainListItems2[i]).attr("value");
$mainSelectList2[i] = $('<option></option>')
.text($mainSelectListValues2[i])
.attr('id','mainLinkOption')
.click(function() {
var $thisOptionText2 = $(this).text();
$('.'+$currentDropMenu).html($thisOptionText2+' Drop');
$('#dropSelectChosen').html($thisOptionText2+' Drop');
return false;
});
$dropSelectMainCurrent.append($mainSelectList2[i]);
}
$('#dropSelectMain').append($dropSelectMainCurrent).show();
The click function on this item to be appended works perfectly in Firefox but does not work in IE.
Attachments (0)
Change History (3)
Changed June 12, 2010 06:59PM UTC by comment:1
component: | unfiled → event |
---|---|
type: | bug → feature |
Changed June 25, 2010 03:41AM UTC by comment:2
See also dup #4780 which proposes implementing by hooking the select event and divining how options change.
Changed November 11, 2010 02:36AM UTC by comment:3
resolution: | → patchwelcome |
---|---|
status: | new → closed |
The fix proposed in #4780 seems like it would require too much code to be practical in core, given this is not a critical bug. Anyone with an idea for a succinct patch, please reopen the ticket and we can discuss. All other lurkers, feel free to register here on Trac and vote for this bug using the links at the top of the page.
Unfortunately, IE doesn't support click events on option elements.
http://msdn.microsoft.com/en-us/library/ms535877%28VS.85%29.aspx
The W3C says it should though:
http://www.w3.org/TR/html401/interact/forms.html#h-17.6
I'll change this to a feature request.