I have two list items listed below:
<li name="luxury" class="cars luxury>
<div id="featured_lux" name="featured" class="carImg_lux col2_lux ">
My Luxury Car<img border="0" class="car-image_lux" src="/images/toycar_luxury.gif">
</div>
<div class="brandName_lux col2_lux">
<h2 class="showBig_lux">
Ferrari or Ford Mustang
</h2>
</div>
</li>
AND this
<li name="normal" class="cars normal>
<div id="featured_normal" name="normal" class="carImg_normal col2_normal ">
My Normal Car<img border="0" class="car-image_lux" src="/images/toycar_normal.gif">
</div>
<div class="brandName_normal col2_normal">
<h2 class="showBig_normal">
Alto or Innova
</h2>
</div>
</li>
Both sections look similar. The only difference is their CSS class and content.
Is there a way to easily swap the CSS classes for both sets of elements using jQuery? For example, applying the Luxury CSS class to the Normal Car Section and vice versa.
I know I can do this using addClass() and removeClass() in jQuery. But is there a more direct approach with minimal lines of code?
This change should occur by default based on some condition, without requiring any clicking or hovering.
I prefer not to use any external libraries if possible.
Please help. Thank you :)