jQuery,當我使用它創建一個包含表單元素的模式窗口時,它會在我提交表單時取出這些元素。形式的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的exaple:
<script>
$(document).ready(function(){
$("#add_photo").dialog({
autoOpen: false,
buttons: {
"Ok": function() {
$(this).dialog("close");
}
}
});
});
那麼通過螢火蟲的inspetion期間我nocited,是jQuery的實際消除內我的表單元素#add_photo並將它們放在DOM中的表單之外,所以即使在HTML中,模式對話框在我的表單中也是如此,在DOM中它不是......
這就是我遇到問題的原因!
有沒有人遇到類似的問題?
任何解決方案?!非常感謝你!
對不起,誤解了你的問題。我用jQuery UI對話框複製了你的問題,所以它可能有錯誤的代碼。您可能想要向jQuery團隊提交一份關於它的錯誤報告。 – Randy 2009-02-19 23:53:46