Adding rows and columns on button clicks bootstrap -


i have requirement user should able add rows , columns dynamically in bootstrap table. on button click new row , other button click new columns should appear.

similarly on button click of '-', row needs deleted , other button click, column needs deleted.

i new bootstrap 3. guidance of great help!!

you can use jquery that, here's simple example : https://jsfiddle.net/1okx6pja/ html :

<button onclick='add()'>   add </button> <table>   <tr>     <th>content</th>     <th>delete</th>   </tr>   <tbody>     <tr>       <td>something</td>       <td>         <button onclick='rm()'>           remove         </button>       </td>     </tr>   </tbody> </table> 

javascript :

function rm() {   $(event.target).closest("tr").remove(); }  function add() {   $("table").append("<tr><td>new thing</td><td><button onclick='rm()'>remove</button></td></tr>"); } 

if don't understand feel free ask


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -