I've done a lot of searching but can't find out why my jQuery .submit()
will not trigger. I've also tried with .click()
for the submit button.
I've currently got a div template (includes a form):
<div class="reply-to-existing-message" style="display: none">
<form class="reply-message-form">
<textarea id="post-reply-message-textarea" name="PostReplyMessage[message]" rows="3" cols="40" style="resize: none"></textarea>
<input class="reply-to-message-id" type="hidden" name="PostReplyMessage[id]" />
<input class="post-reply-message-submit" type="submit" value="Reply"/>
</form>
</div>
I append this to a message using jQuery when the reply button is clicked (produces a drop down reply form so user can reply to a message). This works fine (double checked using firebug too).
However, my jQuery code doesn't produce the alert when I click on the submit button, so it's not even triggering. Could someone please explain why this is occurring, thanks! jQuery code:
$(document).ready(function() {
$('.reply-message-form').submit(function() {
alert('test');
return false;
}) ;
});