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
Post a Comment