Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it valid HTML to insert a hidden input between table rows?

Tags:

html

Background: I am writing a Java app which auto generates a HTML table. As well as adding table rows, this app may insert hidden inputs. However, at present it simply inserts them into the table at the next opportunity, for example:

<table>
    <tr> ... </tr>
    <input type="hidden" />
    <tr> ... </tr>
</table>

So, my question: Is it valid HTML to insert a hidden input between rows like this, or is this likely to cause problems?

like image 960
Matt Dunn Avatar asked Nov 24 '10 10:11

Matt Dunn


3 Answers

It's not valid.

<!ELEMENT TABLE - -
     (CAPTION?, (COL*|COLGROUP*), THEAD?, TFOOT?, TBODY+)>
like image 80
Pekka Avatar answered Oct 20 '22 09:10

Pekka


No, it's not.

You should use the W3C validator and check by yourself your webpages : http://validator.w3.org/.

like image 33
Jean-Bernard Jansen Avatar answered Oct 20 '22 10:10

Jean-Bernard Jansen


It's not valid.

From http://validator.w3.org/

Line 9, Column 27: document type does not allow element "input" here

like image 23
Kimtho6 Avatar answered Oct 20 '22 11:10

Kimtho6