javascript - How do I place focus on an element in dojo that only has a class and not an id - Stack Overflow

I have a textarea where it only allows 150 characters how do I make the focus go from the textarea to t

I have a textarea where it only allows 150 characters how do I make the focus go from the textarea to the error message after a user exceeds the maximum number of characters.

I have a textarea where it only allows 150 characters how do I make the focus go from the textarea to the error message after a user exceeds the maximum number of characters.

Share Improve this question asked Dec 9, 2010 at 15:39 AmenAmen 7134 gold badges15 silver badges28 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 4

You must set an identity for the element and then execute document.getElementById('elementId').focus(). If you have troubles with double used id's, then declare a global variable with a sequence number and increase this number (and use it as part of the element id) every time.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745394393a4625811.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信