开发者

How can I find the first textbox in a container using Javascript?

开发者 https://www.devze.com 2022-12-10 12:21 出处:网络
I want to us开发者_StackOverflowe javascript to find the first textbox in a container, so I can set it to focused, but the textbox could be nested. Is there an easy way I can cycle through until I com

I want to us开发者_StackOverflowe javascript to find the first textbox in a container, so I can set it to focused, but the textbox could be nested. Is there an easy way I can cycle through until I come across the first textbox?


document.getElementById('container').getElementsByTagName('textarea')[0].focus();

0

精彩评论

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