开发者

How to dynamically set focus to next text box in ui:repeat

开发者 https://www.devze.com 2023-01-22 11:13 出处:网络
I 开发者_JAVA技巧have one text box immediately after that one button. If i click on that button dynamically i get one more text box, but the focus is not coming to new text box. Can any one suggest so

I 开发者_JAVA技巧have one text box immediately after that one button. If i click on that button dynamically i get one more text box, but the focus is not coming to new text box. Can any one suggest something.

Thanks in advance Venkat


You need to execute element.focus() on the new texbox after its insertion to give it focus.

E.g.

var element = document.getElementById('newElementId');
element.focus();

Also available in jQuery

$('#newElementId').focus();
0

精彩评论

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

关注公众号