Button


For input tag we have to specify the type as "button", then it will render a button in output.

Syntax:

<input type="button" />

Example:

<html> <head> <title>HTML Tutorial</title> <script language="javascript"> function checkcomments() { if (document.getElementById("txtComments").value == "") alert("Please enter your comemnts."); } </script> </head> <body> <div> Please post your comments :<br /> <textarea id="txtComments" name="txtComments" rows="10" cols="50"></textarea> <br /> <input type="button" id="btnPost" value="Post" onclick="checkcomments();" /> </div> </body> </html>

Output:

Please post your comments :