jQuery showHide() Extension
Clicking to either show or hide something gets coded all the time, and it's a nause, so here is a one line jQuery extension to toggle show/hide.
2. ...it extends jQuery so that you can do:
1. Smash this piece of javascript in your header or somewhere useful:
$.fn.extend({ showHide: function() { if ($(this).is(':visible')) $(this).hide('slow'); else $(this).show('slow'); }});
2. ...it extends jQuery so that you can do:
onClick='$("#someDivOrSimilar").showHide();'
Comments