i am trying to use jquery selector with and array of objects. here is an example..
//Declaration
var filterItems = Array();
filterItems[0] = { clickDiv: "CategoryPanelHeader", div: "NarrowByCategoryPanelWrapper" };
filterItems[1] = { clickDiv: "ExpandYourResultsHeader", div: "ExpandResultPanelWrapper" };
filterItems[2] = { clickDiv: "Keyword", div: "KeywordDiv" };
filterItems[3] = { clickDiv: "Manufacturer", div: "NarrowByManufacturerPanelWrapper" };
filterItems[4] = { clickDiv: "Credentials", div: "CredentialsDiv" };
and the selector
$(document).ready(function () {
//binds the click events...
for (var i = 0; i < filterItems.length; i++) {
$('#'+ filterItems[i].clickDiv).live('click', function () {
togglemenu($('#' + filterItems[i].div));
});
}
});
i am able to read each item properly when i make an alert but jquery is not binding the click events.
how would i go about using an array to bind the onclick events?