Hello,
I have the following piece of JQuery in my script. I have added the alerts for debugging purposes.
- $(document).ready(function()
- {
- $('.preview').click(function()
- {
- alert('1');
- $('#form').submit(function()
- {
- alert('2');
- });
- alert('3');
- });
- });
And the accompanying HTML is the following:
- <form method="post" action="form.php" id="form">
- <input type="hidden" name="key" value="value" />
- <input type="submit" name="submit" value="submit" />
- </form>
- <div class="preview">Submit</div>
When I click the div.preview, only
1 and
3 are alerted. In other words, JQuery is implemented properly, but the form is not submitted. I am using JQuery 1.3.2.
What did I do wrong? How can I submit the form using the div.preview?