Example
Alert id, type, and value of a submit button, and disable button:
<html>
<head>
<script type="text/javascript">
function alertId()
{
var txt="Id: " + document.getElementById("submit1").id;
txt=txt + ", type: " + document.getElementById("submit1").type;
txt=txt + ", value: " + document.getElementById("submit1").value;
document.getElementById("submit1").disabled=true;
alert(txt);
}
</script>
</head>
<body>
<form>
<input type="submit" id="submit1" value="Show values" onclick="alertId()" />
</form>
</body>
</html> |
Try it yourself »
|