Praveen Chinthala
Praveen Chinthala

Reputation: 185

div is not working in IE inside table definition

The div tag is not working inside table definition:

<table>
<tr></tr>
<div id="choice"><tr>
<td>-------</td>
<td>-------</td>
<td>-------</td>
<td>-------</td>
</tr></div>
<tr></tr>
</table>

If I am trying---> getElementById("choice").innerhtml="some data with td's" is not working in IE browser?

But if I use div, by starting new table like,

<table>
<tr></tr>
<div id="choice"><table>
<tr>
<td>-------</td>
<td>-------</td>
<td>-------</td>
<td>-------</td>
</tr>
</table>
</div>
<tr></tr>
</table>

But can I make this with only one table, to run on IE.

Upvotes: 0

Views: 574

Answers (1)

daveoncode
daveoncode

Reputation: 19588

Table tag must follow a specific semantic. You can insert tags (divs and other ones) only inside TD or TH! It's not possible to insert any tag between table /table that are not one of the following: tr, td, th, thead, tbody, tfoot (and anyway you have to nest them properly!). This is unfortunately a quite common mistake which can breaks table-structured form like:

<form>
  <table> 
    <tr>
      <td>
        <input type="text" name="foo" />
        <input type="submit" value="send" />
      </td>
    </tr>
    </form>
  </table>

The above example its hard to debug... so pay attention in order to respect table semantic

Upvotes: 3

Related Questions