Hi,
I have an array of buttons that when clicked on, opens or closes content on my site. I need to be able to track which one is open so that when I click on that button again, I will know whether or not to close the content.
Here's my array:
var imageOptions = ['.corporateNeeds', '.marketResearch', '.corpStrategic', '.employeeTraining', '.administration', '.wellnessManagement'];
And the content that will open once you click on one of the buttons.
var options = ['.option1', '.option2', '.option3', '.option4', '.option5', '.option6'];
Then I loop through the array and show the content of whichever one was clicked on:
jQuery.each(imageOptions, function (k) {
$(imageOptions[k]).click(function () {
hideOptions()
$(options[k]).fadeIn();
$(options[k].contentOpen) = true;
});
});
What I want to know is if there is a way of tracking the current clicked button by dot syntaxing a variable i.e. ($(options[k].contentOpen) = true;) onto that array button. I know this can be done in AS, but I need to know how to do this in jQuery.
Thanks ;)