Using <input> Tags Directly Inside a <table>

I am creating a table with several editable rows. as an employee of each line so that you can change multiple names at the same time. I have some hidden fields inside that should also be looped back with table rows.

The problem is that having the input inside the table tags is not valid xhtml. And I don’t want to wrap them inside <tr><td> tags, as this will explicitly create a new column for hidden fields that don't need it.

Does anyone know if I can wrap them inside something else to make it valid xhtml?

+7
html php xhtml
source share
5 answers

You can put a hidden <input> in an existing cell.

+6
source share

They are hidden, you can place them next to any visible input and be in order.

 <tr> <td><input type="text" name="fname" /></td> <td><input type="text" name="lname" /> <input type="hidden" name="cid" value="11" /> <input type="hidden" name="uid" value="12" /> </td> </tr> 
+4
source share

What happened to putting a hidden input tag in the final column?

 ... <td> <input type="text" name="yourname" /> <input type="hidden" name="thisrowuniqueid" value="123" /> </td> ... 
0
source share

I am not 100% sure if this will work or be checked, but you can try setting the hidden rows and columns to visibility.

 tr.hidden, td.hidden { visibility: hidden; } 

It’s worth taking a picture.

0
source share

this is a perfectly valid strict XHTML code. You can add input fields to table tags

  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Dicabrio.com</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> </head> <body> <form id="test" method="post" action="test.php"> <fieldset> <legend>test</legend> <table> <tr><td> <label>test</label><input type="text" name="test" value="" /> </td></tr> </table> </fieldset> </form> </body> </html> 
0
source share

All Articles