Answers for "html confirm on href"

3

a href confirm javascript

<a href="delete.php?id=22" onclick="return confirm('Are you sure?')">Link</a>
Posted by: Guest on October-21-2020
0

html link confirm

<a href="delete.php?id=22" onclick="return confirm('Are you sure?')">Link</a>

<!-- or -->
<a href="delete.php?id=22" class="confirmation">Link</a>
<script type="text/javascript">
    var elems = document.getElementsByClassName('confirmation');
    var confirmIt = function (e) {
        if (!confirm('Are you sure?')) e.preventDefault();
    };
    for (var i = 0, l = elems.length; i < l; i++) {
        elems[i].addEventListener('click', confirmIt, false);
    }
</script>
Posted by: Guest on August-05-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language