2

I am working in react JS. I want to make an input field editable on double click. is it possible in react or should I use a third party library?

2 Answers 2

1

If I understood your question correctly, you could simply add an onDoubleClick event listener to your input and use it to toggle readOnly:

const [readOnly, setReadOnly] = useState(true);
return (
  <input readOnly={readOnly} onDoubleClick={() => setReadOnly(false)}/>
)
Sign up to request clarification or add additional context in comments.

Comments

0

Yes, it is possible in three ways. You can use Bootstrap 3, Jquery, or JQuery UI as well. Bootstrap is the best option among all these because of having excess material over the internet. You can use "X-Editable". This will provide you to make that specific field editable of will open a pop-over on the input field. Link: https://vitalets.github.io/x-editable/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.