I'm trying to replace current dom element with new element i made.
I implemented following line
$(this).parent().replaceChild(newElem,this);
But it gives error saying $(this).parent().replaceChild is not a function
because replaceChild is not a jQuery function, what would be equivalent in jQuery?
If what you want is to replace the inside:
$(this).empty().append('<p>replacement</p>')
If you want to use pure jQuery you can use the replaceWith method
$(this).replaceWith(newElem);
you can refer this link :
http://api.jquery.com/replaceWith/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With