0

I need help

How do I make a button do something?

1st Jun 2016, 5:05 PM
AskDomOfficialTumblr
AskDomOfficialTumblr - avatar
4 Answers
+ 1
<input type="button" value="Hi there" />
1st Jun 2016, 7:32 PM
James Flanders
0
Is this button part of a form or a stand alone element? In the first case you may be thinking of the submit button of a form (check out the form sections of the SoloLearn course on HTML5). In the latter case just use a button tag (http://www.w3schools.com/tags/tag_button.asp) with a onclick element or other event attribute (e.g. <button type="button" onclick="alert ('hello')">Click me</button>).
9th Nov 2016, 12:05 PM
Giulio Pellitta
Giulio Pellitta - avatar
0
I mean 'How do I make a button increase the value of a variable
9th Nov 2016, 4:40 PM
AskDomOfficialTumblr
AskDomOfficialTumblr - avatar
0
Put the code to increase the variable as argument for the onclick attribute. <button type="button" onclick="x=x+1;">increase variable x </button>
9th Nov 2016, 5:04 PM
Giulio Pellitta
Giulio Pellitta - avatar