Is it possible to know the content type of the cell in a HTML table using Javascript? -
i need store contents of html table in array in javascript. so, know content type (text/dropdown/input box) of each cell before accessing content of cell, can access cell value accordingly. kindly guide me how know content type beforehand.
you use
<table> <tr> <td><input type="text" id="something"></td> <td><select id="something_else"></select></td> </tr> </table> document.getelementbyid("something").tagname; //returns: input document.getelementbyid("something_else").tagname; //returns: select
Comments
Post a Comment