javascript onclick
document.getElementById("myBtn").addEventListener("click", function() {
alert("Hello World!");
});
tlačidlo onclick javascript
var button = document.querySelector('button');
button.onclick = function() {
//do stuff
}
javascript onclick
var myElem = document.getElementByID('ElemID');
myElem.onclick = function() {
//do stuff
}
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...
}
tlačidlo javascript onclick
document.getElementById('button').onclick = function() {
alert("button was clicked");
};