Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

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>
 
PREVIOUS NEXT
Tagged: #html #link #confirm
ADD COMMENT
Topic
Name
9+4 =