Creating a form dynamically

Posted by Nathan on Stack Overflow See other posts from Stack Overflow or by Nathan
Published on 2010-05-15T14:56:02Z Indexed on 2010/05/15 15:04 UTC
Read the original article Hit count: 333

Filed under:
|

Hi, I use a search button that creates a form dynamically at the server side and returns it with Jquery syntax. After I fill-up the form and click on submit button, there is another .submit() Jquery function that suppose to be called to validate input before data is sent to the server. But, for some reason, this function is never called, and the data is request is sent. In more details:

This is the form that the serach button creates dynamically at the server side and "prints" to html page with Jquery:

<form action=... name="stockbuyform" class="stockbuyform" method="post">
<input type=text value="Insert purchasing amount">
<input type="submit" value="Click to purchase">
</form>

And here is the .submit() function :

$(".stockbuyform").submit(function() {
    alert("Need to validate purchasing details");
}

But whaen I click on purchase button, the .submit() function is never called. Does it mean that I can't use another Jquery call with the answer I got in the first call?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about AJAX