Category Archives: jQuery

jQuery HTML5 Placeholder Input Fallback (for browsers that do not support the placeholder attribute)

Hey, placeholder is a really useful HTML5 feature but unfortunately not all browsers support it. So here is a small jQuery script that will replicate placeholder functionality for older browsers. Read more for the code.

Continue Reading →

Simple jQuery plugin for Vertically Centering

Came across this while needing to vertically center a div within another div: 1234567891011(function ($) { // VERTICALLY ALIGN FUNCTION $.fn.vAlign = function() {     return this.each(function(i){     var ah = $(this).height();     var ph = $(this).parent().height();     var mh = Math.ceil((ph-ah) / 2);     $(this).css(’margin-top’, mh);     });

Continue Reading →