I am trying to create a basic validation of an HTML form in Javascript. My form is stored in a table, and I have an additional column to the right of each input with the identifier "ErrorX", which is initially filled with some text to show it the required field.
<FORM NAME="ContactForm" METHOD=POST ACTION='Order3.php' onsubmit="return validateForm()"> <TABLE> <TR> <TD ALIGN=LEFT>Your name:</TD> <TD ALIGN=RIGHT><INPUT TYPE=TEXT ID="Field1" NAME="Field1"></TD> <TD ALIGN=LEFT ID="Error1">Required</TD> </TR> </TABLE> <input type=submit value='Confirm ->'></FORM>
When the submit button is clicked, I have a code that checks the fields and tries to change the rightmost column text. The line of code that does this:
document.getElementById("Error1").innerHTML = "ERROR";
The code executes and correctly detects the error, and the existing wording is deleted, but the new text is not displayed. If I request the value of document.getElementById ("Error1"). InnerHTML, I get the correct text, but it does not appear on the screen.
I use Safari v5.1.2, and it works with basic examples that I copied from the Internet, so I think this is my code, not the browser.
source share