I have a form which I cannot change and I have to handle its submit function from jquery only.
The form have radio buttons only. I want to submit the form without the page refereshed when a radio button is checked.
Here is the code which i tried.
$('input[type="radio"]').click(function(){
if ($(this).is(':checked'))
{
$('form#my-form').submit(function(){
alert('form submitted');
});
}
});
It should alert the “form submitted” but it does not.
Any thing which I am doing wrong?
If you want to submit the form without pageload, then you need to go for ajax.
If you want the alert while submitting, you need to modify ur code a bit..