How do I know if form has any value?
Unanswered
In&Out posted this in #help-forum
In&OutOP
How do I know if form has any value?
14 Replies
In&OutOP
Do i use useRef or what?
When you submit you can receive FormData. Is that what you mean?
@Noronha When you submit you can receive FormData. Is that what you mean?
In&OutOP
No, when a form has any value, like a letter in it
In&OutOP
I want to recreate a component that MUI has, where a placeholder moves above the input field when it's active
I want to recreate this
New Guinea Singing Dog
I think you could use this event handler to remove/add a custom CSS class and make sure to have the transition value so it animates back and forth
@New Guinea Singing Dog https://www.w3schools.com/jsref/event_onfocus.asp
New Guinea Singing Dog
Sorry it would be better to use
focusin and focus out to listen for when the user clicks on it/leaves
focusin and focus out to listen for when the user clicks on it/leaves
@New Guinea Singing Dog https://www.w3schools.com/jsref/event_onfocus.asp
In&OutOP
I know that already, but that doesn't count when there is a value in field
New Guinea Singing Dog
Couldnt you add an extra check like add the event listener
then also add a if condition in the function
e.g
then also add a if condition in the function
e.g
if (!!e.input.value) { return }
//else remove the classIn&OutOP
Thanks it works