javascript - Onclick confirmation and then redirect -


i trying confirm redirect new page.

if delete return before confirm confirms either way if keep return not redirect link.

<button name="payment" class="btn btn-xs-6 btn-danger btn-block" type="button"     onclick="return confirm('are sure want cancel?');window.location.href='cancel';"     value="fav_html">cancel payment </button> 

you need value of confirm(), indicates if user confirmed or cancelled. so, instead of

return confirm('are sure want cancel?'); window.location.href='cancel'; 

you should do

if (confirm('are sure want cancel?')) window.location.href='cancel'; 

Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -