尋找一個腳本,將按鈕單擊時將輸入值1複製到輸入2並添加+1以設置文本框。將輸入1中的值複製到輸入2 onclick
b = document.getElementById('tussenstand').value;
var theTotal1 = b;
$(document).on("click", "#button1", function(){
theTotal1 = Number(theTotal2)
$('#eindstand').val(theTotal2);
});
$('#eindstand').val(theTotal2);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<input id="tussenstand"></input>
<input id="eindstand"></input>
<input id="sets"></input>
<button id="button1">click</button>
在此先感謝。
'theTotal2'在哪裏設置?你究竟想要達到什麼目的?即使給你的代碼,它也不是很清楚。 –
爲什麼你要在html和javascript中添加click事件? – jcubic
哦,對不起,我沒有必要現在看到它。 @jcubic –