html link confirm

Solutions on MaxInterview for html link confirm by the best coders in the world

showing results for - "html link confirm"
Violeta
17 Aug 2020
1<a href="delete.php?id=22" onclick="return confirm('Are you sure?')">Link</a>
2
3<!-- or -->
4<a href="delete.php?id=22" class="confirmation">Link</a>
5<script type="text/javascript">
6    var elems = document.getElementsByClassName('confirmation');
7    var confirmIt = function (e) {
8        if (!confirm('Are you sure?')) e.preventDefault();
9    };
10    for (var i = 0, l = elems.length; i < l; i++) {
11        elems[i].addEventListener('click', confirmIt, false);
12    }
13</script>