【发布时间】:2009-02-19 22:58:32
【问题描述】:
jQuery,当我使用它来创建一个包含表单元素的模式窗口时, 当我提交表单时,它会取出这些元素。
表格示例:
<form enctype="multipart/form-data" action="/system/article/add/" class="from" method="post">
<label for="article_title" class="required">Title:</label>
<input class="formfield" id="article_title" name="article_title" value="" type="text">
<label for="url" class="required">Url:</label>
<input class="formfield" id="url" name="url" value="" type="text">
<div id="add_photo" style="width: auto;" class="ui-dialog-content ui-widget-content" title="Add Photo">
<label for="photo_title" class="optional">Photo title:</label>
<input class="formfield" id="photo_title" name="photo_title" value="" type="text">
<label for="photot" class="optional">Photo thumb:</label>
<input type="file" name="photot" id="photot" class="formfield">
<label for="photo_checkbox" class="optional">Include lighbox?</label>
<input name="photo_checkbox" value="0" type="hidden">
<input class="checkbox" id="photo_checkbox" name="photo_checkbox" value="1" type="checkbox">
<label for="photo_big" class="optional">Photo:</label>
<input type="file" name="photo_big" id="photo_big" class="formfield">
</div>
</form>
JS 示例:
<script>
$(document).ready(function(){
$("#add_photo").dialog({
autoOpen: false,
buttons: {
"Ok": function() {
$(this).dialog("close");
}
}
});
});
所以我在通过 firebug 进行检查期间注意到的是,jquery 实际上删除了我在#add_photo 中的表单元素并将它们放在 DOM 中的表单之外,所以即使在 html 中很难模态对话框在我的表单中,在 DOM 中它是't ....
这就是我遇到问题的原因!
有没有人遇到过类似的问题?
有什么办法吗?!非常感谢!
【问题讨论】:
-
抱歉,误解了您的问题。我用 jQuery UI 对话框复制了你的问题,所以那里的代码可能有问题。你可能想向 jQuery 团队提交一份关于它的错误报告。
标签: javascript jquery dom