I was trying to make something for my wiki with js that when you click on a text it turns it into textarea with a button and when you click the button it updates the text.
I tried adding button with changing a div value but it didn’t work.
I was trying to make something for my wiki with js that when you click on a text it turns it into textarea with a button and when you click the button it updates the text.
I tried adding button with changing a div value but it didn’t work.
2
Answers
You could hide the paragraph element when it’s clicked, and add a textarea and button after it. Then assign an event listener to the button to update the paragraph’s
textContent
and display it again.A basic example:
You can simply use
contenteditable
property