+ 5

Button in Html [Solved]

In Html - why we need to write <button type="button">text</button> What is wrong with <button>text</button> Tnx

22nd Sep 2020, 6:03 AM
FrankoS
14 Answers
+ 6
I also found a interesting topic about it .You can have a look at it: https://html.com/attributes/button-type/
22nd Sep 2020, 7:15 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 16
Yes, if there was an input tag, we could tell <Input type="submit" value= "Submit"/> If you using button tag Always specify the type attribute for a <button> element, to tell browsers what type of button it is. Otherwise: with button tag you can provide different functionality Like submit form and reset form etc.
22nd Sep 2020, 6:34 AM
Prachi The Pari ⭐
Prachi The Pari ⭐ - avatar
+ 6
Don't know much about html .Maybe the reason is there are so much type of button: For example: <button type="submit"> submit</button> or <button type="reset">reset</button> https://www.w3schools.com/tags/att_button_type.asp
22nd Sep 2020, 6:28 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 5
Because system does not know what is the type of the input
22nd Sep 2020, 6:23 AM
JAY • ≫
JAY • ≫ - avatar
+ 3
Type attribute with value button is not needed at all for interactive UI features. It is required only when you have a backend to listen to form submission and the button is used to submit or reset the form. https://www.w3schools.com/tags/att_button_type.asp
22nd Sep 2020, 7:11 AM
Gordon
Gordon - avatar
+ 3
1. <Button>submit</button> 2. <Input type="button" value="submit">
22nd Sep 2020, 7:45 AM
Hriday Kalita
+ 3
Ok sry Didn't know that
22nd Sep 2020, 4:43 PM
FrankoS
+ 2
Tnx
22nd Sep 2020, 6:56 AM
FrankoS
+ 2
<button>text</button> Also works . But it is preferred to use a type attribute and you should also use.
22nd Sep 2020, 4:31 PM
Arnav Kumar [Less/Not Active]
Arnav Kumar [Less/Not Active] - avatar
+ 2
Franko Stipanov sir if u have got the answer write in the question name (solved) And mark the correct answer
22nd Sep 2020, 4:35 PM
JAY • ≫
JAY • ≫ - avatar
+ 2
<body> <form> <input type ="submit" value="submit" /> </form> </body>
23rd Sep 2020, 1:08 PM
K M Suneth K
K M Suneth K - avatar
+ 2
Declaring the type helps to its functionality
23rd Sep 2020, 8:24 PM
Felix Madison
Felix Madison - avatar
+ 1
Good practice is to use the type attribute . However one can dispense with it.
23rd Sep 2020, 4:13 PM
Dushyant Kumar Tyagi
Dushyant Kumar Tyagi - avatar
+ 1
Here type= button.. Is giving a signal to computer to type the text BUTTON on which user will click
24th Sep 2020, 2:43 AM
Ashish Kumar
Ashish Kumar - avatar