Bug Tracker

Opened 10 years ago

Closed 10 years ago

#6206 closed bug (worksforme)

.html() Form

Reported by: liaodrake Owned by:
Priority: Milestone: 1.4
Component: manipulation Version: 1.4.2
Keywords: Cc:
Blocked by: Blocking:

Description

problem with jQuery adding <form> tags to DOM.

eg: $('#obj').html("<form ...><input ...></form>");

in this example, all the elements with in the form tags will be added to the DOM, but the form tags themselves will be skipped.

expects: <div id='obj'> <form ...><input ...></form> </div>

results: <div id='obj'> <input ...> </div>

Change History (3)

comment:1 Changed 10 years ago by john

Component: unfiledmanipulation
Resolution: worksforme
Status: newclosed

Do you have an example? There was an issue with inserting forms in 1.4 that was fixed in later versions of jQuery (should be working in 1.4.2).

comment:2 Changed 10 years ago by liaodrake

Resolution: worksforme
Status: closedreopened

_Me.html("\n<div class='UploaderUserInput'>\n\t<div id='Uploader1' class='UploaderUserInputGroup'>\n\t\t<div class='UploaderIcon'><img src='" + opts.emptyIcon + "' /></div>\n\t\t<div class='UploaderFormInputElements'>\n\t\t\t" + opts.additionalField + "\n\t\t\t<form action= method='post' enctype='multipart/form-data'>\n\t\t\t\t<div class='FileName'><label for='" + opts.fileFieldName + "'>File: </label><input type='file' name='" + opts.fileFieldName + "' /></div>\n\t\t\t\t<div class='btnUpload'><button name='btnUpload'>Upload</button></div>\n\t\t\t</form>\n\t\t</div>\n\t</div>\n</div>\n");

1.4.2 returns: <div class="UploaderUserInput">

<div id="Uploader1" class="UploaderUserInputGroup">

<div class="UploaderIcon"><img src="/core/images/icons/attach_paperclip.png"></div> <div class="UploaderFormInputElements">

<div class="FileTitle"><label for="pdfTitle">Title: </label><input name="pdfTitle" type="text"></div>

<div class="FileName"><label for="EquipmentPDFFileName">File: </label><input name="EquipmentPDFFileName" type="file"></div> <div class="btnUpload"><button name="btnUpload">Upload</button></div> </div>

</div>

</div>

1.3.4 returns: <div class="UploaderUserInput">

<div id="Uploader1" class="UploaderUserInputGroup">

<div class="UploaderIcon"><img src="/core/images/icons/attach_paperclip.png"></div> <div class="UploaderFormInputElements">

<div class="FileTitle"><label for="pdfTitle">Title: </label><input name="pdfTitle" type="text"></div>

<form action="" method="post" enctype="multipart/form-data">

<div class="FileName"><label for="EquipmentPDFFileName">File: </label><input name="EquipmentPDFFileName" type="file"></div> <div class="btnUpload"><button name="btnUpload">Upload</button></div>

</form>

</div>

</div>

</div>

comment:3 Changed 10 years ago by john

Resolution: worksforme
Status: reopenedclosed

I can't duplicate this, I created the test case and the form is created just fine: http://dev.jquery.com/~john/ticket/6206/

Note: See TracTickets for help on using tickets.