dynamic hide div
All div hide by default and show div dynamic on click of link
HTML
<div class="castle"></div>
<div class="commercial"></div>
<div class="common"></div>
<div class="cultural"></div>
JavaScript
$(document).ready(function () {
$("body div").each(function () {
var myarray = {
"castle": "0",
commercial: "3",
common: "0",
cultural: "2",
dioni: "0",
holidays: "0",
island: "2",
nereides: "2",
others: "0",
peninsula: "0",
thetis: "0"
}; // the reall long array;
var a = $(this).attr("class").split(' ')[0]; // in case there are two divs, split
$("." + a).html(myarray[a] + " hours"); // array.a doesn't work
});
});