Skip to main content

Questions tagged [focus]

Focus indicates the component of the graphical user interface which is currently selected to receive input.

focus
3172 votes
54 answers
831k views

How to stop EditText from gaining focus when an activity starts in Android?

I have an Activity in Android, with two elements: EditText ListView When my Activity starts, the EditText immediately has the input focus (flashing cursor). I don't want any control to have input ...
Mark's user avatar
  • 39.8k
1814 votes
11 answers
2.9m views

How to remove focus border (outline) around text/input boxes? (Chrome) [duplicate]

Can anyone explain how to remove the orange or blue border (outline) around text/input boxes? I think it only happens on Chrome to show that the input box is active. Here's the input CSS I'm using: ...
Joey Morani's user avatar
  • 26.2k
733 votes
25 answers
413k views

Is there a way to detect if a browser window is not currently active?

I have JavaScript that is doing activity periodically. When the user is not looking at the site (i.e., the window or tab does not have focus), it'd be nice to not run. Is there a way to do this using ...
Luke Francl's user avatar
  • 31.3k
548 votes
49 answers
479k views

How to show soft-keyboard when edittext is focused

I want to automatically show the soft-keyboard when an EditText is focused (if the device does not have a physical keyboard) and I have two problems: When my Activity is displayed, my EditText is ...
Ludovic Landry's user avatar
436 votes
8 answers
542k views

How to reset / remove chrome's input highlighting / focus border? [duplicate]

I have seen that chrome puts a thicker border on :focus but it kind of looks off in my case where I've used border-radius also. Is there anyway to remove that?
Jiew Meng's user avatar
  • 86.5k
433 votes
18 answers
467k views

Android: Force EditText to remove focus? [duplicate]

I would like to be able to remove the focus from the EditText. For example if the Keyboard appears, and the user hides it with the back button, I would like the focus and the cursor to disappear. How ...
Alex1987's user avatar
  • 9,457
431 votes
13 answers
1.1m views

How can I set focus on an element in an HTML form using JavaScript?

I have a web form with a text box in it. How do I go about setting focus to the text box by default? Something like this: <body onload='setFocusToTextBox()'> so can anybody help me with it? I ...
tenstar's user avatar
  • 10.3k
334 votes
8 answers
535k views

Is it possible to focus on a <div> using JavaScript focus() function?

Is it possible to focus on a <div> using JavaScript focus() function? I have a <div> tag <div id="tries">You have 3 tries left</div> I am trying to focus on the above <...
OM The Eternity's user avatar
332 votes
7 answers
202k views

Which HTML elements can receive focus?

I'm looking for a definitive list of HTML elements which are allowed to take focus, i.e. which elements will be put into focus when focus() is called on them? I'm writing a jQuery extension which ...
Paul Turner's user avatar
  • 39.7k
298 votes
12 answers
520k views

How to focus on a form input text field on page load using jQuery?

This is probably very simple, but could somebody tell me how to get the cursor blinking on a text box on page load?
chris's user avatar
  • 21.1k
289 votes
18 answers
156k views

Prevent the keyboard from displaying on activity start

I have an activity with an Edit Text input. When the activity is initialized, the Android keyboard is shown. How can the keyboard remain hidden until the user focuses the input?
Fcoder's user avatar
  • 9,176
262 votes
6 answers
280k views

jQuery lose focus event

I'm trying to show up a container if a input field gets the focus and - that's the actual problem - hide the container if focus is lost. Is there an opposite event for jQuery's focus? Some example ...
xijo's user avatar
  • 4,366
251 votes
35 answers
211k views

In React ES6, why does the input field lose focus after typing a character?

In my component below, the input field loses focus after typing a character. While using Chrome's Inspector, it looks like the whole form is being re-rendered instead of just the value attribute of ...
spunge's user avatar
  • 3,027
245 votes
9 answers
268k views

How do you clear the focus in javascript?

I know this shouldn't be that hard, but I couldn't find the answer on Google. I want to execute a piece of javascript that will clear the focus from whatever element it is on without knowing ahead of ...
Andres's user avatar
  • 5,169
242 votes
24 answers
124k views

Focus-follows-mouse (plus auto-raise) on Mac OS X

(I don't want to hear about how crazy I am to want that! :) Focus-follows-mouse is also known as point-to-focus, pointer focus, and (in some implementations) sloppy focus. [Add other terms that will ...

15 30 50 per page
1
2 3 4 5
489