I have a table in html. Some cells is bold and some is normal. How I can check if some cell is bold (for example i,j) and get text of that cell without tag .
Cells can have only text. If it bold – it should contain tag <b>. For example:
<tr>
<td>
Not bold text
</td>
<td>
<b> Bold text </b>
</td>
</tr>
PS I can’t use class or id properties.
PSS It would be better without jQuery code, we are not using it for now
See this answer how to get a reference to the cell: https://stackoverflow.com/a/3052862/34088
You can get the first child with
cell.firstChild. This gives you a text node or a<B>node. You can check this with thenode.nodeTypewhich is 1 for DOM nodes or 3 for text nodes. Which gives: