<input type="text" name="" id="jgChatInput" class="duihIntI" />
<script> /*輸入框依次顯示文字*/ var userIput = document.querySelector(".duihIntI"); var i = 0; var s = "在此輸入問題可直接對話"; var clock = setInterval(function() { i++; if(i > 12) { i = 0; } var p = s.slice(0, i); userIput.setAttribute("placeholder", p); }, 600) userIput.addEventListener("focus", function() { clearInterval(clock) userIput.setAttribute("placeholder", "") }) /*依次顯示文字結束*/ </script>