Hello everyone.
I need to display confirmation dialog on image click. Code in "onclick" section of image should be only executed if jquery confirmation dialog returned true.
At this point when user clicks on $(".submit_image") - dialog is displayed, but form is still submitted.
The logic should be the same for both jquery.alerts plugin or regular javascript confirm dialog.
<form name="myform">
<img class="submit_image" onclick="myform.field1.value='1';myform.field1.value='2'; myform.submit();">
</form>
$(document).ready(function(){
// catch submit
$(".submit_image").click(function(e){
jConfirm('Can you confirm this?', 'Confirmation Dialog', function(r) {
return r;
});
});
});