How do i do- if button pressed then value = true and use the value in js | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How do i do- if button pressed then value = true and use the value in js

i want to create a button which, when pressed will initiate a alert code saying "button pressed"

27th Jan 2018, 1:49 PM
Code Ninja
Code Ninja - avatar
5 Answers
+ 6
<button type="submit" onclick="alert('button pressed');">Press me!</button> Handle the onclick JS event, check https://www.sololearn.com/learn/JavaScript/2758/
27th Jan 2018, 1:58 PM
Dev
Dev - avatar
+ 6
You're welcome. Glad you found it useful :)
27th Jan 2018, 2:22 PM
Dev
Dev - avatar
+ 3
Wanthanai I see that this is your first post on SoloLearn. Well here is your 1 lesson pal, unhelpful answers are not appreciated here
26th Feb 2018, 10:15 AM
Code Ninja
Code Ninja - avatar
+ 2
thanks man.. exactly what i needed
27th Jan 2018, 2:15 PM
Code Ninja
Code Ninja - avatar
- 1
g
26th Feb 2018, 3:46 AM
Wanthanai Kansomg
Wanthanai Kansomg - avatar