YouTip LogoYouTip

Prop Url Autofocus

HTML DOM Input URL autofocus Property

HTML DOM Input URL autofocus Property

-- Learning is not just about technology, but also about dreams!

JavaScript Reference

Overview

JavaScript Objects

Browser Objects

DOM Objects

HTML Objects

<input> - time

<input> - week

Explore Further

  • Programming
  • Scripting Languages
  • Software
  • Web Design & Development
  • Programming Languages
  • Web Service
  • Development Tools
  • Computer Science
  • Web Services
  • Scripts

Input URL autofocus Property

Input URL Object Reference Input URL Object

Example

Check if the URL field automatically gets focus after the page loads:

var x = document.getElementById("myURL").autofocus;

x output result is:

true

Try it yourself Β»


Definition and Usage

The autofocus property sets or returns whether a URL field should automatically get focus when the page loads.

This property reflects the HTML autofocus attribute.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the autofocus property.

Note: Internet Explorer 9 and earlier IE versions or Opera 12 and earlier Opera versions do not support the autofocus property.

Note: Internet Explorer or Safari browsers do not support the HTML <input> element with the type="url" attribute.


Syntax

Return the autofocus property:

urlObject.autofocus

Set the autofocus property:

urlObject.autofocus=true|false

Property Values

Value Description
true|false Specifies whether the URL field should get focus after the page loads.
  • true - The URL field gets focus.
  • false - Default. The URL field does not get focus.

Technical Details

Return Value: A Boolean. Returns true if the URL field automatically gets focus after the page loads, otherwise returns false.

Related Pages

HTML Reference: HTML <input> autofocus Attribute


Input URL Object Reference Input URL Object

← Prop Url DisabledProp Url Autofocus β†’