Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#8329 closed bug (duplicate)

IE bug when appending html button

Reported by: kevin_aceace@… Owned by:
Priority: low Milestone: 1.next
Component: attributes Version: 1.5
Keywords: Cc:
Blocked by: Blocking:

Description

The following line of code causes a javascript error in IE8 (and probably older versions) but works fine in FireFox:

$('<button/>').addClass('btnShowAll').attr({title: 'Show All, No Search Conditions', type: 'button'}).html('Show All').appendTo('body');

If you remove the type attribute from the attr array, it works fine. I am currently working around the bug by using the following line of code which works fine in both browsers:

$('<button class="btnShowAll" type="button" title="Show All, No Search Conditions">Show All</button>').appendTo('body')

According to w3schools (http://www.w3schools.com/tags/att_button_type.asp), type="button" is the default for IE and not the W3C standard which is type="submit" but I don't think this shouldn't cause an error.

Change History (4)

comment:1 Changed 12 years ago by kevin_aceace@…

jsfiddle link with test case: http://jsfiddle.net/m9SVV/

comment:2 Changed 12 years ago by dmethvin

Resolution: duplicate
Status: newclosed

Sorry but IE won't allow you to change the type of a button. See the remarks here and in the dup:

http://msdn.microsoft.com/en-us/library/ms534700%28v=vs.85%29.aspx

comment:3 Changed 12 years ago by dmethvin

Duplicate of #8232.

comment:4 Changed 12 years ago by jitter

Component: unfiledattributes
Priority: undecidedlow

This restriction is also noted in the docs. http://api.jquery.com/attr

Last edited 12 years ago by jitter (previous) (diff)
Note: See TracTickets for help on using tickets.