toggle vanilla JS
this is simple method toggle & show/hide html elements
by slawe
HTML
<a href="#" id="dugme">dugme</a>
<div id="nesto">slawe</div>
JavaScript
HTMLElement.prototype.show = function()
{
this.style.display = '';
}
HTMLElement.prototype.hide = function()
{
this.style.display = 'none';
}
HTMLElement.prototype.toggle = function()
{
if (this.style.display == 'none')
this.show();
else
this.hide();
}
var __a = document.getElementById('dugme');
__handler = function(e)
{
e.preventDefault();
document.getElementById('nesto').toggle();
};
__a.addEventListener('click', __handler);