Dynamic id selector. - value is NULL
Hello i`m trying to make a function that show and hide some elements but i have problem with select ID`s from div`s.
This is my code:
HTML:
- onmouseover="change_visibility(document.getElementById(this.id));"
JS:
- function change_visibility(idd){
var element = '#menu_'+idd.id;
//alert(element);
$(element).hover(function () {
if ($(this).is(":hidden")) {
$(this).show();
} else {
$(this).hide();
}
});
}
Alert works fine but function says "$(element) is NULL", I have no ideas to solve this.
Anybody know what I'm doing wrong?