So, to show and hide certain DIV tags within my site I got the following codes
$('#ONE').live('click', function () {
$('.hide').css('display', 'none');
$('#b-ONE').css('display', 'block');
});
$('#TWO').live('click', function () {
$('.hide').css('display', 'none');
$('#b-TWO').css('display', 'block');
});
where a click on the div namend "ONE" opens a certain "b-ONE" div, and so on. It works flawlessly but is a pain when the list gets longer. You see where it says "ONE" and "TWO" in the JS ... is there any way I can turn these "ONE" and "TWO" into variables, so I can have up to 40 divs and don't have to type the above code for every DIV, and have a sleek code where I only have to type that finction once with variables?
I'm looking into something like this but lack the in-depth JS / jQuery knowledge:
$('#VARIABLETEXT').live('click', function () {
$('.hide').css('display', 'none');
$('#b-VARIABLETEXT').css('display', 'block');
});
Where a click on a div named "TWENTYONE" shows the div "b-TWENTYONE"
Any help is highly appreciated!