javascript - If checkbox checked then trick button to continue to next page -


how javascript? i'm trying figure out way in javascript trigger submit button below if checkbox checked. it.

<input type="checkbox" name="product[6]" value="1" checked="checked">  <input type="submit" value="continue"> 

thank help!

tim

updated

you can handle submit() event , add condition bellow :

js :

$("#target").submit(function( event ) {     event.preventdefault(); //prevent submit action here      //condition on checkbox     if($( "input[name='product[6]']:checked" )){         $('#submit-btn').click(); //handle submit if condition true     } }); 

Comments