+ 1
Event execution in JS. With if statement.
I want to use if when button on webpage is clicked like If(//when button is clicked){//execute this}; And how could I display a claculated number like num = x+i = 10; in document.getelementbyid("id").innerHTML =num; Please write basic beginner codes. I need it fast. I need to make a code which calculates score when correct button is clicked.⌨
1 ответ
+ 1
You can either do it in the html:
<button id="enter" onclick="func()"></button>
Or in javascript:
document.getElementById("enter").onclick = function() {
// Your Code
}