function toggleBlind(el, speed) { (el.css('display') == 'none') ? el.slideDown(speed) : el.slideUp(speed); } $(document).ready(function () { $('input,textarea').focus(function () { $(this).addClass('focus'); }); $('input,textarea').blur(function () { $(this).removeClass('focus'); }); });