Skip to content Skip to sidebar Skip to footer

Td Without Parent Table Tag

HTML: text one this is next td

Solution 2:

If you inspect the element in chrome you will notice the code has changed to the following:

<body>
    text one <br>
    this is next td
    <buttononClick="myFunc()">click</button><scripttype="text/javascript">//<![CDATA[ 

    function myFunc() {
    var second=document.getElementById('tdSecond').innerHTML;
    alert(second);

    //var second2=document.getElementsByTagName('td')[1].innerHTML;
    //alert(second2);  
    }

    //]]>  

    </script></body>

The td elements have been stripped by the browser as they are not valid.

Solution 3:

Try this.There are html problems. try this html

<tableborder="1"><tr><tdclass="tabletd"> text one </td><br><tdclass="tabletd"id="tdSecond"> this is next td</td></tr></table><buttononclick="myFunc()">click</button>

Post a Comment for "Td Without Parent Table Tag"