2016-08-15 103 views

回答

1

您可以通過將一個事件監聽器附加到按鈕來實現JavaScript。 Fiddle

<script> 
var button = document.getElementById("go"); 
button.addEventListener("click", function(){ 
    document.getElementById("name").focus(); 
}); 
</script> 
0

我假設你正在做一個異步調用,而不是加載另一個完整的頁面,否則這不會是一個相關的問題。在onclick事件中使用jquery焦點方法。這裏有更多信息的鏈接。

https://api.jquery.com/focus/

相關問題