• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

set focus

Explorer ,
Apr 20, 2006 Apr 20, 2006

Copy link to clipboard

Copied

I have the form with the following fields
1) Radio YES/NO
2) URL Link text box
3) Full Article text box

When user clicks on YES, I want to set the cursor focus on URL Link text box. And when user clicks on No, I want to set the cursor focus on Full Article text box.
Here is my code but it didn’t work. Please help.
TOPICS
Getting started

Views

877

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 21, 2006 Apr 21, 2006

Copy link to clipboard

Copied

I'm assuming it wasn't your intention to mark your question as the answer.



Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 23, 2007 Aug 23, 2007

Copy link to clipboard

Copied

How do you set focus on a form field when the page is loaded in the browser?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 23, 2007 Aug 23, 2007

Copy link to clipboard

Copied

quote:

Originally posted by: cmswbp1234
How do you set focus on a form field when the page is loaded in the browser?

Write a js function that set's the focus and call it on the body onLoad event. Google javascript focus() for examples.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 23, 2007 Aug 23, 2007

Copy link to clipboard

Copied

cmswbp1234 wrote:
> How do you set focus on a form field when the page is loaded in the browser?

With a bit of JavaScript that runs once the page has finished loading.
Many ways to do this from simple to sophisticated, a bit of Google
searching will turn up lots of examples. I don't have a code snippet at
my fingertips.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 23, 2007 Aug 23, 2007

Copy link to clipboard

Copied

cmswbp1234 wrote:
How do you set focus on a form field when the page is loaded in the browser?
Google is useful in more ways than one. Open the Google page. You should find that it does what you seek -- there is focus on the search field.

Examine the page's source code. Look for the function sf(). Do what we all do -- copy.




edited: "is focus is" changed to "is focus"


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 29, 2007 Aug 29, 2007

Copy link to clipboard

Copied

LATEST
inputname.setFocus();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation