$.fn.visible = function() {
return this.css('visibility', 'visible');
};
$.fn.invisible = function() {
return this.css('visibility', 'hidden');
};
$('Element').click(function(){
$(this).visible(); or $(this).invisible();
});
var btn = $('#btn');
btn.on('click',function(){
btn.hasClass('green') ? red(btn) : green(btn);
});
function green(el){
el.removeClass();
el.addClass('green');
}
function red(el){
el.removeClass();
el.addClass('red');
}
$('.green').on('click', function(){
//Some Function
});
$('.red').on('click', function(){
//Some Function
});
function closeIt()
{
///Your Function
}
window.onbeforeunload = closeIt;