Hello, so I have a div with default class Unlocked. When I click on it, I remove the class Unlocked and change it to locked class, and when I click again, go to the old Unlocked.
This my js
$(document).ready(function() {
console.log("Test");
$(".Unlocked").click(function(){
console.log("HI2");
$("#LeftMenu").css('margin-left', '0');
$("#LockLeftMenu").removeClass("Unlocked");
$("#LockLeftMenu").addClass("locked");
$("#lbl_lock").text("UnLock");
});
$(".locked").on("click", function (event) {
console.log("HI");
$("#lbl_lock").text("Lock");
$("#LeftMenu").css('margin-left', '-260px');
$("#LockLeftMenu").removeClass("locked");
$("#LockLeftMenu").addClass("Unlocked");
});
});
This my html i need before click,
<div id="LeftMenu">
<div id="LockLeftMenu" class="Unlocked">
<label id="lbl_lock">Lock</label>
</div>
after click,
<div id="LeftMenu" style="margin-left: 0px;">
<div id="LockLeftMenu" class="locked">
<label id="lbl_lock">UnLock</label>
</div>
but after click on the old $(.Unlocked) elements, what I see in console.log is only HI2.HI2.HI2... I can't get to HI the $(.locked).