Opened 14 years ago
Closed 14 years ago
#4627 closed bug (invalid)
JQuery appendTo Bug
Reported by: | lagden | Owned by: | |
---|---|---|---|
Priority: | critical | Milestone: | 1.4 |
Component: | core | Version: | 1.3.2 |
Keywords: | append, appendTo | Cc: | [email protected]… |
Blocked by: | Blocking: |
Description
<script type="text/javascript"> var controllerID='11'; var controllerEID='1'; var controllerPARENTID='0';
$(document).ready(function(){
Bug $('<input type="hidden" name="id" value="'+controllerID+'" />').appendTo('#frm');
Fine $('<input type="hidden" name="uid" value="'+controllerID+'" />').appendTo('#frm');
$('<input type="hidden" name="eid" value="'+controllerEID+'" />').appendTo('#frm'); $('<input type="hidden" name="parentId" value="'+controllerPARENTID+'" />').appendTo('#frm');
$('#bt').click(function(){postar();return false;});
});
function postar(){
var f=$('#frm');
Bug returns [object HTMLInputElement]<input type="hidden" value="11" name="id"> Expected frm alert(f.get(0).id); }
</script>
</head> <body>
<form action="post.php" id="frm" method="post" onsubmit="return false;">
<label for="nome">Nome completo:</label> <input type="text" id="nome" name="nome" /><br/> <button id="bt">OK</button>
</form>
</body> </html>
Attachments (1)
Change History (2)
Changed 14 years ago by
Attachment: | appendTo.htm added |
---|
comment:1 Changed 14 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
The key is this line in your example:
alert(f.get(0).id);
The bug you are reporting is actually outside jQuery, since f.get(0)
gets the raw DOM element and you are selecting the id
property.
There are already open bugs requesting that jQuery work around this browser bug where possible, but this particular case could not be worked around at all by jQuery since the bug at the point of use is raw DOM and not jQuery.
sample bug file