In jQuery, how do I select and add a class to a class when the class does not have a value?
Here is some example code:
<div class="">
<div class="">
<span class=""><i class=""></i></span>
<div class="">
<span class=""></span>
<span class=""></span>
</div><!-- /.info-box-content -->
</div><!-- /.info-box -->
</div>
If I only have the above code, how can I achieve the following code by using jQuery:
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="info-box">
<span class="info-box-icon bg-aqua"><i class="fa fa-envelope-o"></i></span>
<div class="info-box-content">
<span class="info-box-text">Messages</span>
<span class="info-box-number">1,410</span>
</div><!-- /.info-box-content -->
</div><!-- /.info-box -->
</div>
I know that jQuery has the addClass() function, yet I am not sure how to use this when the class I wish to add to does not have a class value.
Is there a specific jQuery technique that I should be using?
Thanks
Can you add IDs to your elements?
Then you can do $('#element').addClass('info-box') etc