php - add dynamic row on click of a button with some values cell empty using jquery or javascript -


i have designed table row having textbox, drop-down, contents , button. values taken database , displayed using php. when click on button should replicate last row of table button again if click on button of dynamic row same thing should happen. tried following code not working, code working if put button outside table.

i used on() instead of live(), not working, please

   <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>     </head>     <body>     <table id=`tableid`>     <tr><td><input type="text" name="row1"></td><td>     <select><option>apple</option><option>mango</option></select>      </td><td><button id='buttonid'>add row</button></td><td>content1</td><td>content2</td></tr>      </table>    <script>        $(document).ready(function() {        $( "#buttonid" ).live( "click",  function(){       var cnt = $('#tableid tr:last').clone();       cnt.find('td:nth-last-child(2)').empty(); //last 1 td       cnt.find('td:nth-last-child(1)').empty(); //last td       $('#tableid').append(cnt);       });        });       </script></body></html> 

<table id="tableid"> 

not

<table id=`tableid`> 

not sure not working http://jsfiddle.net/76d1gj0l/


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -