Ticket #6206 (closed bug: worksforme)
.html() Form
| Reported by: | liaodrake | Owned by: | |
|---|---|---|---|
| Priority: | Milestone: | 1.4 | |
| Component: | manipulation | Version: | 1.4.2 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
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
comment:1 Changed 3 years ago by john
- Status changed from new to closed
- Resolution set to worksforme
- Component changed from unfiled to manipulation
comment:2 Changed 3 years ago by liaodrake
- Status changed from closed to reopened
- Resolution worksforme deleted
_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 3 years ago by john
- Status changed from reopened to closed
- Resolution set to worksforme
I can't duplicate this, I created the test case and the form is created just fine: http://dev.jquery.com/~john/ticket/6206/
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

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).