My current code is affecting all elements instead of just the intended one. I've experimented with classes and ids, ruling out those as potential issues.
I'm hoping for my JavaScript to target only the selected element, not all of them. Check out a demo here.
HTML
<div class="mainPageDiv">
<div class="dashBoardContainer">
<div class="dbContainer1 column">
<div class="flip">
<div class=" card">
<div class="face front">
<div class=" portlet ">
<div class="portlet-header"> <span class="red text-uppercase"> edit button works</span>
<div class="dropdown pull-right "> <span class="pull-right ">
<span class="" id="edit-changes"><a href="#" > Edit <span class="glyphicon glyphicon-pencil pull-right flipLink" > </span>
</a>
</span>
</span>
<hr class="hrflipForm">
</div>
<!-- portlet-content -->
</div>
<div class="portlet-content lastViewedArticle ">
<br>text
<br>text
<br>text
<br>text
<br>text
<br>text
<br>text
<br>text</div>
<!-- portlet-header -->
</div>
<!-- portlet- -->
</div>
<!-- moveOnchange-->
<div class="face back">
<div class="inner">
<div class="portlet">
<div class="flipForm">
<ul class="list-inline pull-right ">
<li class="flipControl" id="save-changes"> <span class="pull-right glyphicon glyphicon-floppy-disk gi-1x opacity7 "></span>
</li>
</ul>
</div>
<!-- Header Closed -->
<div class="portlet-content lastViewedArticle ">
<br>text
<br>text
<br>text
<br>text
<br>text
<br>text
<br>text
<br>text
<br>text
<br>text
<br>text
<br>text</div>
<!--- Portlet content -->
</div>
</div>
</div>
</div>
</div>
<!-- dbContainer1 -->
</div>
<div class="dbContainer2 column">
<div class="flip">
<div class=" card">
<div class="face front'>
<div class=" portlet ">
<div class="portlet-header"> <span class="red text-uppercase"> edit button doesn't works</span>
<div class="dropdown pull-right "> <span class="pull-right ">
<span class="" id="edit-changes"><a href="#" > Edit <span class="glyphicon glyphicon-pencil pull-right flipLink" > </span>
</a>
</span>
</span>
</div>
<!-- portlet-content -->
</div>
<div class="portlet-content lastViewedArticle ">
<br>text
<br>text
<br>text
<br>text
<br>text
<br>text
<br>text
<br>text</div>
<!-- portlet-header -->
</div>
<!-- portlet- -->
</div>
<!-- moveOnchange-->
<div class="face back">
<div class="inner">
<div class="portlet">
<div class="flipForm">
<ul class="list-inline pull-right">
<li class="flipControl" id="save-changes"> <span class="pull-right glyphicon glyphicon-floppy-disk gi-1x opacity7"></span>
</li>
</ul>
</div>
<!-- Header Closed -->
<div class="portlet-content lastViewedArticle ">
<br>text
<br>text
<br>text
<br>text
<br>text
<br>text
<br>text
<br>text
<br>text
<br>text
<br>text
<br>text</div>
<!--- Portlet content -->
</div>
</div>
</div>
</div>
</div>
<!-- dbContainer2 -->
</div>
</div>
Javascript
$('#edit-changes').on('click', function () {
$('.back').css('transform', 'rotateY(0deg)');
$('.front').css('transform', 'rotateY(180deg)');
});
$('#save-changes').on('click', function () {
$('.front').css('transform', 'rotateY(0deg)');
$('.back').css('transform', 'rotateY(180deg)');
});
$(function () {
$(".column").sortable({
connectWith: ".column",
handle: ".portlet-header",
cancel: ".portlet-toggle",
placeholder: "portlet-placeholder ui-corner-all"
});
$(".portlet")
.addClass("ui-widget ui-widget-content ui-helper-clearfix ui-corner-all")
.find(".portlet-header")
.addClass("ui-widget-header ui-corner-all");
$(".portlet-toggle").click(function () {
var icon = $(this);
icon.toggleClass("ui-icon-minusthick ui-icon-plusthick");
icon.closest(".portlet").find(".portlet-content").toggle();
});
});