开发者

How to set focus on form with more of one button?

开发者 https://www.devze.com 2023-01-31 12:08 出处:网络
I have two buttons for the same form. In the HTML code I declared f开发者_如何学Pythonirst the \"Button One\" and after the \"Button Two\".

I have two buttons for the same form. In the HTML code I declared f开发者_如何学Pythonirst the "Button One" and after the "Button Two".

When I display the form, the focus is on the "Button One", but I would like to have it on the other one without change them the screen position.

What I can do?


$(document).ready(function() {
  $("#Button Two").focus();
});


Set tabindex to the second button less than the first one.

EDIT

yes, you can use javascript, document.getElementById("button2").focus();. Make sure you add this code on page load.

0

精彩评论

暂无评论...
验证码 换一张
取 消