i am newbie in JQuery.
i want to get status of toggle() like it's true or false?
here i want to set variable when toggle gets clicked as true, and when its gets false i want to reset that variable value again.
$(document).ready(function(){
var neck='';
var chest='';
$("#neck,#chest").click(function(){
$(this).toggleClass('opa');
})
})
here in class opa i am just setting opacity level. if it's true then opacity 1 and if it's false then opacity 0.
This code is working fine its toggling class (adding & Removing).
but i want to set neck value as neck="neck" when it's true (clicked first time #neck) or set neck=""; when it's false (clicked second time #neck).
i referred http://api.jquery.com/toggle/ link also but i didn't find my answer.
is it possible to get status like true/false or something like this?