Bug Tracker

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:


<script type="text/javascript"> var controllerID='11'; var controllerEID='1'; var controllerPARENTID='0';


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); }


</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>


</body> </html>

Attachments (1)

appendTo.htm (1.5 KB) - added by lagden 14 years ago.
sample bug file

Download all attachments as: .zip

Change History (2)

Changed 14 years ago by lagden

Attachment: appendTo.htm added

sample bug file

comment:1 Changed 14 years ago by dmethvin

Resolution: invalid
Status: newclosed

The key is this line in your example:


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.

For more information see #4575 and #3113.

Note: See TracTickets for help on using tickets.