question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Clear current value text on focus

See original GitHub issue

Is there a way to clear the current value text when focusing a select with searchable equal to true? Would like the input to empty when focused, and refill when blurred.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:12
  • Comments:20 (2 by maintainers)

github_iconTop GitHub Comments

27reactions
apennellcommented, Jun 24, 2019

Thanks for the simple suggestion, @sombrerox! I used that general CSS approach except instead of targeting their really specific class in a style sheet, I used the style object approach:

const customStyles = {
  singleValue: (provided, state) => {(
    display: state.selectProps.menuIsOpen ? 'none' : 'block',
 )}
}

const App = () => (
  <Select
    styles={customStyles}
    options={...}
  />
);
4reactions
Ricka7xcommented, Dec 1, 2016

I was wondering the same thing!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Clear Input Field on Focus - W3Schools
Click on the input field to clear it: Clear Input Field on Focus. Example. <!-- When the input field gets focus, replace its...
Read more >
How to clear text field on focus of text field - Stack Overflow
9 Answers 9 ; <script type='javascript'> ; var clear = true; function clear(obj) { if(clear) { obj.value = ''; clear = false; }...
Read more >
Clear Textbox or Input Box on focus using JavaScript or jQuery
You can use the onfocus attribute in JavaScript to clear a textbox or an input box when somebody sets focus on the field....
Read more >
How to clear an input field on focus with JavaScript
JavaScript has a onfocus() event that occurs when the element gets focused. This onfocus() event can be used to clear the input field....
Read more >
HTML | Clearing the input field - GeeksforGeeks
Method 1: Clearing Input on Focus. Syntax: ... < input type = "text" onfocus = "this.value=''" value = "Click here to clear" >....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found