I want to create a div around the clicked element without affecting the style of the page and i need to remove the inserted parent after some operations. Do anybody have any idea to do like that?
Edit: Please note that i don’t want to use any JavaScript library
I can’t guarantee it won’t affect styles, but as for the rest, try something like this (inside the click handler function):
If you’re still in the function when you want to remove the new div element:
If not, you’ll need to reaquire it. Let’s assume you have a trigger for that, and
thisis still the clicked element: