"Table Functionality"
Bootstrap 4.0.0 Snippet by lavan

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <link href="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <!DOCTYPE html> <html> <head> <style> table tr td{ border:1px solid black; } </style> </head> <body> <h2>JavaScript Comparison</h2> <p>Assign 5 to x, and display the value of the comparison (x == 8):</p> <table> <thead> <tr> <td>Name</td><td>Age</td><td>Action</td></tr> </thead> <tbody id="demo"> </tbody> </table> <script> var obj={name:'lavan',age:20,gender:'male',child:[ {name:'lavanSon',age:2},{name:'lavanDon',age:3},{name:'lavanWon',age:5}] } var arr=obj.child; for(var i=0;i<arr.length;i++){ if(Number(arr[i].age)>2){ document.getElementById('demo').innerHTML+="<tr> <td>"+arr[i].name+" </td>" + "<td>"+arr[i].age+"</td> <td><button onclick='del()'>Delete</button></td></tr>"; } } function del(){ document.getElementById('demo').innerHTML=''; arr.splice(0,1); for(var i=0;i<arr.length;i++){ if(Number(arr[i].age)>2){ document.getElementById('demo').innerHTML+="<tr> <td>"+arr[i].name+" </td>" + "<td>"+arr[i].age+"</td> <td><button onclick='del()'>Delete</button></td></tr>"; } } } </script> </body> </html>

Related: See More


Questions / Comments: