HTML ऑटोफोकस विशेषता
परिभाषा और उपयोग
विशेषता एक
autofocus
बूलियन विशेषता है।
मौजूद होने पर, यह निर्दिष्ट करता है कि पृष्ठ लोड होने पर तत्व को स्वचालित रूप से फ़ोकस प्राप्त करना चाहिए।
पर लागू होता है
विशेषता का
autofocus
उपयोग निम्नलिखित तत्वों पर किया जा सकता है:
तत्वों | गुण |
---|---|
<बटन> | ऑटोफोकस |
<इनपुट> | ऑटोफोकस |
<चुनें> | ऑटोफोकस |
<textarea> | ऑटोफोकस |
उदाहरण
बटन उदाहरण
ऑटोफोकस वाला एक बटन:
<button type="button" autofocus>Click Me!</button>
इनपुट उदाहरण
पृष्ठ लोड होने पर "प्रथम नाम" इनपुट फ़ील्ड को स्वचालित रूप से फ़ोकस करने दें:
<form action="/action_page.php">
First name: <input type="text" name="fname" autofocus><br>
Last name: <input type="text" name="lname"><br>
<input type="submit">
</form>
टेक्सटेरिया उदाहरण
ऑटोफोकस वाला टेक्स्ट क्षेत्र:
<textarea autofocus>
At w3schools.com you will learn how to make a website. We offer free tutorials in all web development technologies.
</textarea>
ब्राउज़र समर्थन
विशेषता में autofocus
प्रत्येक तत्व के लिए निम्नलिखित ब्राउज़र समर्थन है:
Element | |||||
---|---|---|---|---|---|
form | 5.0 | 10.0 | 4.0 | 5.0 | 9.6 |
input | 5.0 | 10.0 | 4.0 | 5.0 | 9.6 |
textarea | Yes | 10.0 | 4.0 | Yes | Yes |