+ 1
Adding a javascript 'alert' to a html 'button'?
On one of the projects that I have started has me adding an alert command to a button, and I can't figure it out. (48 hours in.) https://code.sololearn.com/Wk4fPV18dXr0/?ref=app
4 Respostas
+ 6
<button
onclick="alert('Hello world')">
Start
</button>
+ 1
Note:
You can change the name of workButton()
HTML:
<button onClick=“workButton()”>Start</button>
JavaScript:
function workButton(){
alert(“Hello”)
}
+ 1
How about like this.
Html button
JavaScript function
https://code.sololearn.com/WQyUaQHeLLuB/?ref=app
0
Hi Icarus8,
Maybe I popped into your code at the wrong moment, but it doesn't look like anything is happening. You've got a button, but no JavaScript.
Maybe start here and see how you get along?
https://www.w3schools.com/js/tryit.asp?filename=tryjs_alert
I hope this helps! :)