Bug Tracker

Opened 11 years ago

Last modified 10 years ago

#8232 closed bug

.attr can't change a submit input — at Version 6

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

Description (last modified by remysharp)

Changing a submit input element to a button (or perhaps another type) causes jQuery to throw a fatal exception:

$('input[type=submit]').attr('type', 'button'); // throws fatal

Working example: http://jsbin.com/arida/2

Note that it throws an exception (which is why I've wrapped them in a try/catch for the example).

Broken in: Chrome 9, Firefox 3.6.x, Safari 5 (not, as jitter had, just IE).

Change History (6)

comment:1 Changed 11 years ago by jitter

Component: unfiledattributes
Priority: undecidedlow
Resolution: invalid
Status: newclosed

Thanks for taking the time to contribute to the jQuery project by writing a bug report and providing a test case!

This is a bug in Internet Explorer that can't be worked around (IE doesn't allow the type attribute to be changed). There is a note about this on http://api.jquery.com/jQuery/ . I notified the api documentation team to add this missing hint to the .attr() api page too.

comment:2 Changed 11 years ago by jitter

#8231 is a duplicate of this ticket.

comment:3 Changed 11 years ago by Adrian Mester <[email protected]…>

Actually this also seems to also happen in Chrome (9.0.597.84 beta) and Firefox (3.6.13). Changing a submit button's type attribute nodeValue to button (ie without using jQuery), works in these browsers. So I think this is a bug in jQuery

comment:4 in reply to:  3 Changed 11 years ago by jitter

Replying to Adrian Mester <[email protected]…>:

Actually this also seems to also happen in Chrome (9.0.597.84 beta) and Firefox (3.6.13). Changing a submit button's type attribute nodeValue to button (ie without using jQuery), works in these browsers. So I think this is a bug in jQuery

Yes this happens in every browser and purposefully so. #1536 and 7d02f06e

comment:5 in reply to:  1 Changed 11 years ago by remysharp

Replying to jitter:

Thanks for taking the time to contribute to the jQuery project by writing a bug report and providing a test case!

This is a bug in Internet Explorer that can't be worked around (IE doesn't allow the type attribute to be changed). There is a note about this on http://api.jquery.com/jQuery/ . I notified the api documentation team to add this missing hint to the .attr() api page too.

Erm...I didn't test IE. It's happening in Chrome 9, Safari 5 and Firefox 3.6.x. I assume the test case wasn't even opened then?

comment:6 Changed 11 years ago by remysharp

Description: modified (diff)
Resolution: invalid
Status: closedreopened
Note: See TracTickets for help on using tickets.