jquery submit failure


I'm trying to submit a form by assigning submit() to a click handler in jquery. My code is currently this:


where #ics_alert_submit is a button in a jquery generated modal window and #ICS_upload_form is the id and name of the form I wish to submit. I can't see any reason why this isn't working. Have I missed something really obvious?!?!

By : musoNic80

"...where #ics_alert_submit is a button in a jquery generated modal window..."

How is the submit button being generated? If it is not present when the page loads, the the click() event isn't getting attached.

If that's the case, you would need:

$("#ics_alert_submit").live('click', function() { 

This will look for #ics_alert_submit to be dynamically added to the DOM, and will attach the event when added.

without having the actual HTML this function is supposed to work on, the only thing I could suggest is look out for case-sensitivity in HTML id names and class names. You have "#ics_alert_submit" as the button, but "#ICS_upload_form" as the form. Make sure the cases match, as outlined here: http://reference.sitepoint.com/css/casesensitivity#

This video can help you solving your question :)
By: admin