JSFiddle - React, Tailwind, and code Playground

by Dream Mkker

HTML

<button id="getValue">=DK 取得全部參數</button>
<button id="newValue">=DK 新增輸入參數</button>
<button id="delValue">=DK 刪除輸入參數</button>
<form id="Ufrom" action="">
<div><input type="text" name="Vlaue0" value="0" /></div>
</form>
<div id="body"></div>

JavaScript

var num = 0;
$("#getValue").click(function(){
    $("#body").text($("#Ufrom").serialize());
});
$("#newValue").click(function(){
    num++;
    $("#Ufrom").append('<div><input type="text" name="Value'+num+'" value="'+num+'" /></div>');
});
$("#delValue").click(function(){
    num--;
    $("#Ufrom").children('div:last').remove();
});