javascript - Jquery removeClass() on click -
hi have problem: want click on div flipped (this work) next step flipp div on click on "x" (this problem).
html code:
<div class="col-md-4"> <div class="balik"> <div class="panel panel-default panel-cube"> <div class=" flip"> <div class="card"> <div class="panel-body face front"> <h4>balík 28 dní</h4> <br> <h1>16,80€</h1> <br> <h4>zisti viac o balíku »</h4> </div> <div class="panel-body face back"> <p class="close">x</p> <a href="#"><h4>o balíku 28 dní</h4></a> » celkom 28 dní na topovanie <br />» 5 topovaných inzerátov <br />» -30% z ceny oproti balíku 7 dní <br /> <br> <button class="btn btn-success"><i class="fa fa-shopping-cart"></i> kúpiť</button> </div> </div> </div> </div> </div> </div>
jquery code:
$(function(){ $('.flip').click(function(){ $(this).find('.card').addclass('flipped') });// work $('.close').click(function(){ $('.flip').find('.card.flipped').removeclass('flipped') }); // not work });
thanks answers.
because .flipped
dynamically-created element, you'd need use event delegation:
http://jsfiddle.net/isherwood/7zg92/
$(document).on('click', '.close', function () { $('.flip').find('.card.flipped').removeclass('flipped') });
Comments
Post a Comment