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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -