/ Published in: jQuery
Fix IE focus, hover and check if there's a default placeholder name
Expand |
Embed | Plain Text
/* ------------------------------------------------------------------ Hint ------------------------------------------------------------- */ $.fn.hint = function(settings) { // defaults settings settings = $.extend({ classFocus: "focus", classOver: "hover", classLabelError: "error" }, settings); return this.each( function() { var elm = $(this); var title = elm.attr('title'); elm // on focus, set value to blank if current value matches title attr .bind("focus", function(){ if(settings.classLabelError) { elm.removeClass(settings.classLabelError); } //if(settings.classLabelError && elm.is(".v-mandatory")) { $("label[@for=" + elm.attr("id") + "]").removeClass(settings.classLabelError); } if (title && elm.val() == title) { elm.val(''); } elm.addClass(settings.classFocus); }) .bind("blur", function(){ if (title && elm.val() === '') { elm.val(title); } elm.removeClass(settings.classFocus); }) .addHover(settings.classOver) .blur();// now change all inputs }); };
You need to login to post a comment.
