I use a search button that creates dynamically on the server side and It gives joke with sentence - configuration. After filling out the form and clicking on the submit button, one more. Submit () is a Jquery function that has to be asked to validate the input to send the data before the server. But, for some reason, this function is never called, and a data request is sent. In more detail:
This is the form that the search button creates on the server side dynamically and "prints" on the HTML page with the jacquery:
Lt; Form action = ... name = "stockbuforform" class = "stockbuforform" method = "post" & gt; & Lt; Input type = text value = "insert purchase amount" & gt; & Lt; Input type = "submit" value = "click to buy" & gt; & Lt; / Form & gt;
And here is the .submit () function:
submit $ (". Stockbuyform") (function () {alert ("verified purchase details ");}
But whaen I click on the purchase button, the .submit () function is never called. What does it mean that I can call any other Jquery call Can not use the answer I got in the first call?
Use event delegation (or.) Probably possibly most suitable for living This par Status:
$ (". Stockbuyform") Live ("Submit", function () {Warning ("purchase details need to be valid");})
What's live (from):
Attach handlers to the event for all elements that match the current selector, or in the future.
So you do not have to worry about AJAX-changed elements that lose their bound event handle. Also, your submission Be sure to return a wrong return from the handler to non-XHR GET / POST.
Comments
Post a Comment