Jquery / Javascript confirmation dialog on href-link

Before submitting or do the action, you can prompt a confirmation by using this simple dialog box.

<a href=”gotopage.php” class=”confirm”>Go To Page</a>

<script type=”text/javascript”>
$(‘.confirm’).on(‘click’, function () {
return confirm(‘Are you sure?’);
});
</script>