Insert text in a td with id with innerHTML - Javascript DOM

Javascript examples for DOM:Element innerHTML

Description

Insert text in a td with id with innerHTML

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <script type="text/javascript">
function insertText () {/*  w w  w .  j a v a  2s  .c  o m*/
    document.getElementById('td1').innerHTML = "Some text to enter";
}

      </script> 
   </head> 
   <body onload="insertText();"> 
      <table> 
         <tbody>
            <tr> 
               <td id="td1"></td> 
            </tr> 
         </tbody>
      </table>  
   </body>
</html>

Related Tutorials