Tag Archives: toggle

Toggle the visibility with jQuery

When it comes to quick JavaScriopt effects one of the most common is to hide and show different elements in the DOM. That occurs in almost every site. If there’s a dynamic menu, there’s for sure attached mouse event that shows/hides some sub menus and so on.

Of course you can achieve this in both jQuery and pure JavaScript approaches. If you use JS it’s something like that;

document.getElementById('element_id').style.display = 'block';
document.getElementById('element_id').style.display = 'none';

where the first row shows how to show an element, and the second one how to hide it in turn. Continue reading Toggle the visibility with jQuery