Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery Confirm function in anchor tag [closed]

Normally when click anchor tag it redirects to some url which is given inside the "href" attribute. Is there is any possiblity here for confirmation. When we click anchor tag it shows confirmation "Are you sure want to continue" if we clicked "yes" it gets redirect to that url which is given inside "href". if we click "no" it remains in same page. Please share any ideas you might have.

like image 282
user Avatar asked Aug 06 '13 11:08

user


People also ask

How to use confirm in anchor tag?

When we click anchor tag it shows confirmation "Are you sure want to continue" if we clicked "yes" it gets redirect to that url which is given inside "href". if we click "no" it remains in same page.

How do you add confirmation in HTML?

The confirm() method displays a dialog box with a message, an OK button, and a Cancel button. The confirm() method returns true if the user clicked "OK", otherwise false .


1 Answers

Try this

<a href="http://www.google.com" onclick="return confirm('Are you sure?')" >click here</a>
like image 151
Satpal Avatar answered Sep 20 '22 01:09

Satpal