I have simple JS(jquery) code and I would like to run it through all three nested arrays. Now it only executes first nested array ([16, 10, 11) and then stops. I have read that "for" loop may work, but I tried and failed :[
Is any1 capable of solving this problem? I will be grateful!
$(function(){
var cat = [[16, 10, 11],[15, 10, 11],[36, 10, 11]];
$('li#hcategory_' + cat[0][0] + ' ul.level2 > li:gt(' + cat[0][1] +')').hide();
var l = $('li#hcategory_' + cat[0][0] + ' .level2 > li').length;
if (l > cat[0][2]) {
$('li#hcategory_' + cat[0][0] + 'span.show_more_button').show();
} else {
$('li#hcategory_' + cat[0][0] + 'span.show_more_button').hide();
}
$('li#hcategory_16 .show_more_button').click(function () {
$('li#hcategory_' + cat[0][0] + ' ul.level2 > li:gt(' + cat[0][1] +')').show('slow');
});
});