#408 closed bug (wontfix)
name attribute removed in Internet Explorer
Reported by: | sam | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.1a |
Component: | core | Version: | 1.1a |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
When I create an input element with a name, the name gets removed when I add it to another element (e.g. a form). the name gets added fine (as indicated by the first alert), but no longer exists after adding (second alert lacks name attribute).
$( function() { var action = $("<input type=hidden>").attr( { "name": "whattodo", "value": "delete" }); alert(action[0].name); // name seems to be added fine alert($("<form>").append(action).html()); // where has name gone? } )
Change History (5)
comment:1 Changed 16 years ago by
Milestone: | → 1.1 |
---|---|
Version: | 1.0 → 1.1 |
comment:2 Changed 16 years ago by
This happens without the use of jQuery as well as pointed out by Dave Methvin on the list.
comment:3 Changed 16 years ago by
This turns out to be one of those persistent IE bugs, well documented here with some unappetizing workarounds:
http://www.easy-reader.net/archives/2005/09/02/death-to-bad-dom-implementations/
The problem I see for applying any of these in jQuery is that there isn't a convenient way to detect the situation and apply the workaround.
comment:4 Changed 16 years ago by
The easiert way to workaround this is to provide the name in the first string, that is:
$( function() { var action = $("<input name='whattodo' type='hidden'>").attr( { "value": "delete" }); alert(action[0].name); // name seems to be added fine alert($("<form>").append(action).html()); } )
Any other ideas? This workaround can hardly be integrated into jQuery, therefore I'd just place a note somewhere in the documentation. But where? $(String)? attr(String, String)?
comment:5 Changed 16 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Added a note in the documentation of attr(String, Object) for this issue.
This sounds like an issue with Internet Explorer and .getAttribute().