Fix Input Focus


/ Published in: jQuery
Save to your folder(s)



Copy this code and paste it in your HTML
  1. /* ------------------------------------------------------------------
  2.   Fix Input Focus -------------------------------------------------- */
  3. $.fn.inpFocus = function(settings) {
  4. // defaults settings
  5. settings = $.extend({
  6. classFocus: "inpFocus"
  7. }, settings);
  8. return this.each( function() {
  9. $(this).find("input:text, input:password, textarea, select").each(function(){
  10. $(this)
  11. .bind("focus.inpFocus", function(){
  12. $(this).addClass(settings.classFocus);
  13. })
  14. .bind("blur.inpFocus", function(){
  15. $(this).removeClass(settings.classFocus);
  16. })
  17. .blur();// now change all inputs
  18. });
  19. });
  20. };

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.