I am 16 and I am pretty new to Web Development. I have been writing a bunch of programs for practice and I got stuck on this one.
I made buttons in html with input tags. So now I want to make those buttons do something in a javascript function, and nothing has worked out for me.
I'd really appreciate some sample code that I can learn from.
My html and javascript looks like this:
function selectPrize() {
var butn1 = document.getElementById.onclick();
if (butn1) {
alert("You won a new Car");
}
}
<input type="button" id="btn1" value="ClickMe" onclick="selectPrize()">