I'm using jQuery's load() function to change content on a page dynamically. It's a application with different 'levels' but the URL never changes.
It's working fine except for the final screen I'm using. I've got a form with text inputs etc that I need to create some form validations for but I can't get on('submit')
to work after the page load. I am using a callback function on the load function and I do run some simple jQuery CSS, etc. to content that is on the final_page.php
so I know that it's successfully running the function AFTER the content is loaded.
I'm trying to simply just apply a preventDefault()
to the form for now to confirm that it's working correctly but the form submits every time I get to that final page so it looks like the on()
function doesn't get bound to the form selector.
Is there some sort of conflicting with submit and load?
$('#main_content').load('final_page.php', function(){
$('#main_content').css({'height':'auto','padding-bottom':'25px','background':'#086c8c'});
$('#hidden_input').attr('value', 'complete');
//GOOD UP TO THIS POINT
$('#final_form').on('submit',function(e){
e.preventDefault();
});
});