Hello, I'm very new in scripting with js. My question is, how can i set an onclick at an h1, which set the display to none at another div?
Here my code:
var iter;
function toggleGroups()
{
function getAllGroups()
{
titlebars = document.getElementsByClassName('titlebar_js');
groupfields = document.getElementsByClassName('inner_groups_gether');
for(i = 0; i < titlebars.length;i++)
{
tb = titlebars[i];
iter = i;
tb.onclick = function()
{
alert(iter);
groupfields[iter].style.display = 'none';
}
}
}
getAllGroups();
}
window.onload = function()
{
toggleGroups(); // Aufruf der Funktion
}
It doesn't work.