Questions tagged [autofocus]

456 questions
121
votes
4 answers

Setting focus on an HTML input box on page load

I'm trying to set the default focus on an input box when the page loads (example: google). My page is very simple, yet I can't figure out how to do this. This is what I've got so far: Password Protected Page
Chris
  • 2,905
  • 5
  • 29
  • 30
91
votes
3 answers

is it autofocus="autofocus" or autofocus?

I seem to recall most (maybe all) attributes in previously versions of HTML (before HTML5) required attributes to have values, like readonly="readonly". Is this true for HTML5 and the autofocus attribute?
Darryl Hein
  • 142,451
  • 95
  • 218
  • 261
84
votes
13 answers

Disable auto focus on edit text

I have an edit text:
Saad
  • 26,316
  • 15
  • 48
  • 69
57
votes
6 answers

Mobile Safari Autofocus text field

In Mobile Safari I am unable to focus onto a text field after setting a delay period. I'm attaching some example code showcasing the issue. If, onclick of the button, you trigger .focus(), everything works as expected. If you hang the focus on a…
boymc
  • 1,217
  • 2
  • 13
  • 17
48
votes
7 answers

in iOS8 using .focus() will show virtual keyboard and scroll page after touch

Prior to iOS8, using the Javascript .focus() method on an input element would appear to have no effect (the virtual keyboard would not display). After the latest iOS 8 release, running the .focus() method seemed to have no effect on page load but…
Mac
  • 1,025
  • 3
  • 12
  • 22
47
votes
10 answers

Set focus on an input with Ionic 2

SOLVED : import { Component, ViewChild} from '@angular/core'; import { Keyboard } from 'ionic-native'; @Component({ templateUrl: 'build/pages/home/home.html' }) export class HomePage { @ViewChild('input') myInput ; constructor() {} …
Thomas
  • 1,509
  • 4
  • 15
  • 25
39
votes
10 answers

How to avoid automatic focus on first input field when popping a HTML form as a JQuery dialog?

I have seen similar questions on SO, including this one, which is old. I read and followed links, but it is unclear whether there is a proper solution to this issue today. My bottom issue is that I am using HTML's placeholder="..." on the input…
Jérôme Verstrynge
  • 57,710
  • 92
  • 283
  • 453
33
votes
4 answers

How to set autofocus only in xaml?

Is it possible, to set the autofocus to the textbox in my xaml file?
David
  • 4,027
  • 10
  • 50
  • 102
20
votes
5 answers

Android: Check whether camera supports auto-focus?

For the Android API version 2.1 and higher, we can use context: getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_AUTOFOCUS) But before version 2.1, how can we perform the same operation? Is there anything like this that does not…
user441316
  • 483
  • 2
  • 5
  • 13
20
votes
1 answer

Autofocus text field on mobile, but no keyboard?

As part of my login and registration forms, if there are errors then it will autofocus the related field. Actually, it not as simple as I thought. Let me try to explain! Basically, on this project, pages are loaded with AJAX. Forms may include an…
Niet the Dark Absol
  • 320,036
  • 81
  • 464
  • 592
19
votes
5 answers

JQuery focus and select on id input field

DEMO FIDDLE
secr
  • 624
  • 4
  • 9
  • 20
18
votes
2 answers

Can I use autofocus on an element with contenteditable?

I'm using the contenteditable attribute on a
in order to make it act as a text field on demand (for users to rename something). But I want to enable autofocus on it as well, so users can begin typing immediately (the
always has…
daGUY
  • 27,055
  • 29
  • 75
  • 119
17
votes
4 answers

iPhone : camera autofocus observer?

I would like to know if it's possible to receive notification about autofocus inside an iPhone application? I.E, does it exist a way to be notified when autofocus starts, ends, if it has succeed or failed... ? If so, what is this notification name ?
Sly
  • 2,105
  • 5
  • 22
  • 28
17
votes
8 answers

Ionic v4 - how do I autofocus on a Input?

I have a view with an input How can I auto focus on this input? What have I tried @ViewChild('codigobarras') input_codigobarras: Input; ... ionViewDidEnter() { this.input_codigobarras.focus(); // didn't…
SpaceDogCS
  • 2,808
  • 3
  • 20
  • 49
16
votes
1 answer

Flash of unstyled content (FOUC) in Firefox when using 'autofocus' in input field

Actually, this is more of an error description than a question. I noticed flash of unstyled content (FOUC) in Firefox on a very simple login page. There are no images used. No heavy CSS. All Javascript placed at the end of the code, right before the…
Christian
  • 325
  • 2
  • 10
1
2 3
30 31