does anyone know why this simple javascript isn't working? it should change the css of the class "t1" from display:none to display: inline to make it appear when the input is empty onSubmit
I just can't understand why it doesnt work?
Thank you so much if your can find where the problem is (btw i want to keep this in pure javascript)
Javascript:
function validate () {
if( document.quote.firstname.value == "" )
{document.getElementByClassName('t1').style = 'display: inline;';
}
}
HTML:
<form name="quote" method="post" action="" onSubmit="validate();">
<fieldset>
<legend>Contact Information</legend>
<div>
<label>*First Name:</label><span class="t1">Please enter your name</span>
<input name="firstname" type="text"/>
</div>
</fieldset>
<div id="f-submit">
<input name="Submit" value="Submit" type="submit"/>
</div>
</form>
CSS:
.t1{
display: none;
font-size:13px;
color: #F33;
text-align: right;
}