Answers for "dom on click"

2

document on click

$(document).on("click","#test-element",function() {
    alert("click");
});
Posted by: Guest on April-24-2021
3

javascript onclick

// The element id (TheElementID) and var name (myElement) can be named anything.
var myElement = document.getElementByID('TheElementID');
myElement.onclick = function() {
	// Carry out a function here...
}
Posted by: Guest on October-19-2020

Browse Popular Code Answers by Language