Learn how to create a dynamic data entry form with JavaScript and Bootstrap in this tutorial. This tutorial will guide you through the process of building a user-friendly interface where users can input data and dynamically add or remove entries. Utilizing HTML, CSS (Bootstrap), and JavaScript, you'll understand how to dynamically generate HTML elements, handle user interactions, and manipulate the DOM to achieve a seamless user experience. Whether you're a beginner looking to enhance your skills or an experienced developer seeking to streamline data entry processes, this tutorial has got you covered. Start building your dynamic data entry form today and take your web development skills to the next level!
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
<title>Create dynamic html Tag</title>
</head>
<body>
<table class="table" id="tab">
<tr>
<th>Name</th>
<th>Father Name</th>
<th>Mobile</th>
<th><a href="#" id="add_btn" class="btn btn-primary">Add</a></th>
</tr>
</table>
<script>
document.getElementById("add_btn").addEventListener('click',function(){
var html = `<tr>
<td><input class="form-control" placeholder="Enter Your name" type="text"></td>
<td><input class="form-control" placeholder="Enter Your Father's name " type="text"></td>
<td><input class="form-control" placeholder="Enter Your Mobile " type="text"></td>
<td><a class="btn btn-danger del" href="#" >Delete</a></td>
</tr>`;
var table = document.getElementById("tab");
table.insertAdjacentHTML('beforeend',html );
})
document.addEventListener('click', function(event) {
if (event.target.classList.contains('del')) {
var row = event.target.closest('tr');
row.remove();
}
});
</script>
</body>
</html>
I'm a dedicated full-stack developer, entrepreneur, and the proud owner of ocec.org.in , hailing from the vibrant country of India. My passion lies in creating informative tutorials and sharing valuable tips that empower fellow artisans in their journey. With a deep-rooted love for technology, I've been an ardent enthusiast of PHP, Laravel, Angular, Vue, Node, JavaScript, jQuery, Codeigniter, and Bootstrap from their earliest days. My philosophy revolves around the values of hard work and unwavering consistency, driving me to continuously explore, create, and share my knowledge with the tech community.
helllo