javascript - IE8 jQuery submit not working for forms -


i have form structure such:

<form id="myform">   <div>     <input .....>     <input ......>   </div>    <div>    <input ....>    <input ....>   </div>    <input type="submit"> </form> 

i need confirm box when form submitted did this:

$('#myform').submit(function(e){   e.preventdefault();   if(confirm('something here')){    $('myform').submit();   } }); 

as know, ie8 not divs in form , html little broken. results in jquery being broken!

how can work around this?

since using submit event handler, if confirmation negative have prevent default action, can done via

it should be

$('#myform').submit(function(e){   if(!confirm('something here')){    e.preventdefault();   } }); 

Comments