jquery mobile - Create Table plugin dynamically using javascript API's -
how create table plugin dynamically using javascript api's in jquery mobile.
now i'm creating table plugin using append method in javascript, want create in javascript api's.
html
<table data-role="table" data-mode="columntoggle" class="ui-responsive table ui-shadow" id="today_app"> <tr><th>name</th><th>duration</th></tr> </table>
javascript
for (var = 0; < servicename.length; i++) { $('#today_app').append('<tr><td>'+servicename[i].name+'</td><td>'+servicename[i].from+'</td></tr>'); }
code without jquery mobile append...
var = document.getelementbyid('today_app'); (var = 0; < servicename.length; i++) { var row = document.createelement("tr"); // create table cells var td1 = document.createelement("td"); var td2 = document.createelement("td"); td1.innerhtml = servicename[i].name; td2.innerhtml = servicename[i].form; // adding cells row row.appendchild(td1); row.appendchild(td2); tableobj.appendchild(row); }
Comments
Post a Comment