javascript - Change DIV width that is before another DIV -


i have structure dynamic divs , have same class, since created automatically.

the problem here that, last of them prior other div other class, have style width:100% instead of width:50% others set css.

here's sample:

<div class="awp_box awp_box_inner"></div> <div class="awp_box awp_box_inner"></div> <div class="awp_box awp_box_inner"></div> <div class="awp_stock_container awp_sct" style="max-width: 400px !important;"></div> 

so want change third div, first , one, other times second, other times fourth, etc...

i css time i'm having hard time finding solution one.

can please give me hand here guiding me in right track put working?

based on comments, following script give need.

$(document).ready(function(){         $('.awp_sct').prev().addclass('full'); }); 

it add class previous element of .awp_sct.

demo


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -