I've recently developed an interactive app that dynamically creates tables based on user input. The app includes a feature where you can specify the number of tables to generate and track the total count of tables added.
Currently, I'm exploring ways to enhance the app by allowing users to input their name or any custom text which will then be displayed in a designated 'Name' box upon clicking the 'Add now' button. Despite numerous attempts, I haven't been successful in modifying the existing functionality to accommodate this text display feature.
You can explore the live version of this project here: http://codepen.io/BabinecJ/pen/BRjJbw
$('[name="cand_no" ]').on('change', function() {
// Implementing logic for valid inputs
if (this.value != '') {
var val = parseInt(this.value, 10);
$(function() {
$('#add').bind('click', function() {
var count = $('#mytbody').children('tr').length;
$('#counter').html(count);
var name = $("#tname").val();
$('#name').html(name);
});
});
$(document).ready(function() {
$('cand_no').keydown(function(event) {
if (event.keyCode == 13) {
event.preventDefault();
return false;
}
});
});
for (var i = 0; i < val; i++) {
var $cloned = $('.template tbody').clone();
$('#studentTable tbody').append($cloned.html());
}
}
});
.template {
border-style: solid;
}
#cand_no {
background-color: red;
}
#add {
color: red;
margin-right: 770px;
margin-top: -35px;
}