JSFiddle - React, Tailwind, and code Playground
HTML
<body>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script type="text/javascript">
var countChar = function(obj) {
var len = obj.value.length;
if (len >= 200) {
obj.value = obj.value.substring(0, 500);
} else {
$(obj).parent().find('.words-left').val((200 - len));
}
};
</script>
<div id="add">
+
</div>
<div id="div">
hi
</div>
</body>
JavaScript
var x = 1;
var count = 0;
$('body').on('click', '#add', function() {
if (count < 6) {
$('#div').append("<div class='line'><input type='text' name = 'txta" + x + "' id='txta" + x + "'><span class =wordtab></span> <textarea rows='9' onkeyup='countChar(this);' cols='50' name = 'txtc" + x + "' id='txtc" + x + "'></textarea> <span class =wordtab></span><input class='words-left' style = 'width:50px' type='text' name = 'txtb" + x + "' id='txtb" + x + "'><span class =wordtab></span><button class='delete' value ='Delete Row'>Delete Row</button></div><div style='margin-left: 750px' id='charNum" + x + "'></div>");
count++;
x++;
} else
alert("Maximum 6 Skills");
});
$('body').on('click', '.delete', function() {
$(this).closest('.line').remove();
count--;
});