<div>
<div class="first">First Name</div>
<div class="last">Last Name</div>
<div class="edit">edit</div>
</div>
When pressing edit, I would like the content inside .first and .last to be replaced with a textbox with the content of the div inside the textbox. Essentially, making the content noticeably editable.
I was able to achieve that with replaceWith.
However, if they click "edit" and then want to cancel, I need the textbox's to disappear and the original content show back up. I realized replaceWith would ruin the existing structure.
I had the idea of using clone, but I'm not sure if that is efficient.
What would be the best way to approach this with jQuery?
I found this how to make jquery-ui.dialog revert a form on cancel which seemed to do something similar to what I needed but I wasn't able to find anything in it that would help do what I wish.
Thanks so much, and I look forward to a reply!
Jacob