如何使輸入值顯示按鈕點擊的每個輸入而不刪除以前的輸入?jQuery獲取按鈕點擊的輸入值
$(document).ready(function(){
$("#btn").click(function(){
var getVal = $("#inputValue").val();
$("p").html(getVal);
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="main">
<fieldset>
<legend>jQuery input value</legend>
<input id="inputValue" type="text" name="text">
</fieldset>
<button id="btn">display value</button>
<p></p>
</div>
的例子是工作中,摘錄作品。 – Li357
@AndrewL。,再次檢查問題。他希望添加值**而不刪除舊值。 – Dekel
哦,woops。感謝您將它引入我的注意:) @Dekel – Li357