I want Ads through prescribed class removal Get ads div set up.
<div class='insideAd'><p>Ad</p></div>
$(function() {
$("body").ready( function() {
// Ads are loaded
$(".loadAd").removeClass();
$("insideAd").addClass();
});
});
I want Ads through prescribed class removal Get ads div set up.
<div class='insideAd'><p>Ad</p></div>
$(function() {
$("body").ready( function() {
// Ads are loaded
$(".loadAd").removeClass();
$("insideAd").addClass();
});
});
On
To select an element with a class that already exists on it:
$(".loadAd")
When you do $("insideAd") you are trying to select a tag with that name, which doesn't exist. Even if you add the . with $(".insideAd"), you won't select any elements because none exist with this class name. To use this syntax the class must already exist.
To remove a class from that selected element, you should state which class to remove. Otherwise it will remove all classes from that element.
$(".loadAd").removeClass("loadAd")
Finally to add another class, you also have to pass the class to add:
$(".loadAd").removeClass("loadAd").addClass("insideAd")
you may want to do something like this: first remove all classes and then add new class to matching elements: