javascript - Find element hasClass and modify the previous one -



javascript - Find element hasClass and modify the previous one -

i have element, lastly one, has step-active class. now, want write method, looks element, has class, remove class , add together previous one. phone call method if button clicked.

i have next piece of html code:

<div class="col-lg-6 col-md-6 step-panel" style="padding-right: 0"> <div class="step container-fluid"> <p>4</p> </div> <div class="step"> <p>3</p> </div> <div class="step"> <p>2</p> </div> <div class="step step-active"> <p>1</p> </div> </div>

this js:

function indicatestep() { $('.step').find().hasclass('step-active'); $(this).removeclass('step-active'); $(this).prev().addclass('step-active'); }

i can't work, tell me why , suggest solution?

i think should trick

function indicatestep() { $('.step.step-active') .removeclass('step-active') .prev() .addclass('step-active'); }

javascript jquery

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -