Click here to Skip to main content
16,011,949 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<!--html way-->
   <input type="button" onclick="alert('Hello World')" value="Click Me">

   <!--javascript way-->
   <button type="button" onclick="alert('Hello World')">Click Me</button>


What I have tried:

i am confused learning the HTML button.they work the same.
can i say that like in my comment or what is the difference? thank you!
Posted
Updated 1-Jul-18 23:46pm

The difference is that one is HTML and the other is Javscript. See W3Schools Online Web Tutorials[^] for more details.
 
Share this answer
 
Comments
Member 13462842 2-Jul-18 5:29am    
yes. i am learning it on W3Schools. which way is more common to use?
Richard MacCutchan 2-Jul-18 6:20am    
That is a good place to start learning. You can also find other tutorials through Google.
Html Input Control Doesn't Have Inner Html Tags.
But In Button Control U Can Add Inner Html Tags.

"<input type="button" value="Hello"/>
<br/>
<button><b style="color:red;">Hello</b></button>"

Exa.
<input type="button" value="Hello"/>
<br/>
<button>"color: rgba(255, 0, 0, 1)">Hello</button>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900