I have a form on a page, however, there’s no submit. There’s a link that launched a modal dialog using colorbox plugin. http://www.jacklmoore.com/colorbox
The link is actually in that dialog. Here’s my code
JS
$('#openModal').colorbox({
html: 'some text <input id="mySubmit" type="button" value="submit form">'
});
$('#mySubmit').click(function() {
$('#myForm').submit();
});
HTML
<div id="openModal">open modal</div>
</form>
Does not seem to work. What am I missing?
You call
.click()before your button is included in the dom. Use event delegation instead:.delegate()http://api.jquery.com/delegate/