+ 1

Hello. Can someone tell me why it works only First time? If you click on <p> it becomes field and you can change text. Thanks

https://code.sololearn.com/W8DYmzUOdIYf/?ref=app

27th Apr 2018, 9:20 PM
Istvan Attila Gazdag
Istvan Attila Gazdag - avatar
2 Answers
+ 2
Here's a working solution: https://code.sololearn.com/WXLv9KQR475D/#html Note, that I've only tested this on Chrome so far. The events weren't working properly, for what you had set up. It's better to show / hide the two elements at different times... the events work better that way. If you remove them, the event callbacks seem to deregister. You had an <input> which you terminated with </input>, however <input> has no end tag. I'd recommend validating your HTML using this: https://validator.w3.org/nu/#textarea The validator can get rid of some errors at times. Note also, that what you're doing is bad user interface design, so unless it's for fun, it isn't recommended.
28th Apr 2018, 12:06 AM
Emma
+ 1
When you remove <input> and add a new <p> you forget to set click handler to the new <p>
27th Apr 2018, 9:38 PM
KrOW
KrOW - avatar