Loading ...

JavaScript: How to set focus to input type textbox control

Who is online?  0 guests and 0 members
home  »  forums   »  asp.net topics   »  client side web development   » JavaScript: How to set focus to input type textbox control

JavaScript: How to set focus to input type textbox control

Posts under the topic: JavaScript: How to set focus to input type textbox control

Posted: 10/10/2011

Lurker 100  points  Lurker
  • Joined on: 9/11/2010
  • Posts: 20

Hi,
In my page there are many textbox controls. Now I need to put focus on them via JavaScript code. How should I do the same?


Posted: 10/11/2011

Lurker 270  points  Lurker
  • Joined on: 1/3/2009
  • Posts: 14

peter smith said:

Hi,
In my page there are many textbox controls. Now I need to put focus on them via JavaScript code. How should I do the same?

At a time focus can be only on one textbox. So to set focus on a textbox you can use .focus() as following

Java script:

document.getElementById("textboxid").focus();

Jquery:

$('#textboxID').focus();


Page 1 of 1 (2 items)