As I’ve been recently working with a website that has a lot of jQuery and AJAX, and my jQuery knowledge was small, I was wondering how to remove the content of a <div> with jQuery. The solution was pretty easy and with just a line of code.
The element we are going to affect will be called ‘Target’.
1. Set the id of the Target to ‘ourtargetid’ (for example).
So for your div we will use:
Easy as that. Now if you would like to remove something by its class attribute, we would use:
And that’s it. It is really simple, yet very useful when you want to remove an element dynamically. If you have any question, please do not hesitate to contact me.
Owner of Juapo2Services
Looking for quality Web Hosting? Look no further than Arvixe Web Hosting!