I would like to do the following:
- Loading on the main page, displaying a modal window
- In the modal field, display the form with one required flag
- When checking the checkbox, click "Submit" and close the modal code window, go to the home page
- Remember this checkmark setting with cookie.
- If users return to the main page, if they checked, the modal block will not be displayed
I did something about it:
http://dev.iceburg.net/jquery/jqModal
That I can get the display of the modal window when the page loads, but I can’t decide how to get the form to make the checkbox mandatory and close the window. I also don't know where to start when setting up a cookie.
Any pointers would be much appreciated.
thank
EDIT: :
Index.html -
$().ready(function() {
$('#ex2').jqm({modal: 'true', ajax: '2.html', trigger: 'a.ex2trigger' });
setTimeout($('#ex2').jqmShow(),2000);
});
2.html - , ajax
function validate(frm) {
if (frm.checkbox.checked==false)
{
alert("Please agree to our Terms and Conditions.");
return false;
}
}
<form action="" method="POST" onSubmit="return validate(form);" name="form">
<input type="checkbox" name="checkbox" id="checkbox" value="1"> I hereby agree to all Terms and Conditions</a>
<input type="submit" value="Submit">
</form>