javascript - how to append table to DIV -
i trying append table div
:
<html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js" type="text/javascript"></script> <script type="text/javascript"> function addstuff() { var html = '<table>'; $.each(function() { html += '<tr><td>' + '</td></tr>'; }); html += '</table>'; $("#divresults").append(html); } </script> </head> <body> <div id="divresults"></div> <button onclick="addstuff()">add stuff</button> </body> </html>
but not working. want dynamically add table div block.
you want append table div try this....
<html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js" type="text/javascript"></script> <script type="text/javascript"> function addtable() { $('#divresults').append('<table width="320" border="1"><tr><td colspan="2" rowspan="1">' + " wdw" + '</td></tr><tr><td width="118">' + "sxs" + '</td><td width="186">' + "xs" + '</td></tr></table>'); } </script> </head> <body> <div id="divresults"> </div> <button onclick="addtable()">add stuff</button> </body> </html>
Comments
Post a Comment