Does this code contain anything invalid. I have a form with a table inside. Is that alright?
<form name="myForm" id="myForm">
<table id="myTab">
<tr>
<td>
<label for="id">User ID:</label>
<input type="text" id="id" />
</td>
</tr>
<tr>
<td>
<label for="pass">Password:</label>
<input type="password" id="pass" name="pass" />
</td>
<td>
<button type="button" class="submit">Submit</button>
</td>
</tr>
<tr><td><input type="reset" /></td></tr>
</table>
<div class="error"></div><div class="correct"></div>
</form>
For the result — http://jsfiddle.net/mBwAh/
A
<form>can contain text and markup (paragraphs, lists, etc.), there are no restrictions listed for what it can contain. Here’s the W3C spec which says so:http://www.w3.org/TR/html4/interact/forms.html#h-17.3
As for you’re
<table>usage, it’s perfectly valid HTML, in fact the<table>element is in the HTML5 spec Here’s the W3C Spec for that:http://www.w3.org/TR/html5/tabular-data.html#the-table-element
You’ll want to also add a
colspanto your<tr>which only contains one<td>, You should also add anameattribute to your<input>as it won’t do anything on submit without it.