下面是生成表單的PHP代碼: form.php的如何將提交事件添加到動態生成的表單?
<?php
echo '
<form action="/wall/comment.php" method="post" id="submit-comment-form" name="'.$postid.'">
<div class="write-comment-profile-pic">
<img src= "'.$myprofilepic.'" width="30" height="30""/>
</div>
<div class="write-comment-textbox-wrap">
<input type="text" class="textbox4" id="write-comment-textbox" value="Write a comment..." name="comment" style="width:65%;" />
</div>
</form>
';
?>
jQuery代碼它得到了form.php的
$('#images img').click(function() {
$.get('form.php', function(data) {
$('#image-pop-up').html(data);
});
});
,這裏是jQuery的代碼需要提交表單:
$('#image-pop-up').on('submit', '#submit-comment-form', function() {
evt.preventDefault();
});
index.html中的圖像,彈出DIV
是一個空 只是
<div id="image-pop-up">
</div>
這是不工作...有什麼不對?如何解決它?
哪裏是你提交? – 2013-02-12 12:31:47
是#提交評論形式裹在#圖像彈出?您的代碼暗示了這一點,請爲這兩個顯示已渲染的標記 – 2013-02-12 12:31:57
圖像彈出是一個對話框嗎? – 2013-02-12 12:34:08