Losing my mind on this one..
How can I do something as simple as..
If div has class "something" then make div#test have a class of "awesome"
<div class="something">hey there</div>
<div id="test">Am I awesome?</div>
Much Thanks!
Losing my mind on this one..
How can I do something as simple as..
If div has class "something" then make div#test have a class of "awesome"
<div class="something">hey there</div>
<div id="test">Am I awesome?</div>
Much Thanks!
Try this:
if ($("div.something").length) {
$("div#test").addClass("awesome");
}
If you want to check the class of a particular div, then change your html
<div id="im_special" class="something">hey there</div>
and then look for the id in the javascript
if ($("div#im_special.something").length) {
$("div#test").addClass("awesome");
}