Created
March 27, 2013 14:19
-
-
Save richardkundl/5254501 to your computer and use it in GitHub Desktop.
JQuery read textbox placeholder member, if the textbox value is empty. Thats wrong. This rVal return empty value, never return placeholder value.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery.fn.rVal = function () { | |
if (this[0]) { | |
var ele = $(this[0]); | |
if (ele.attr('placeholder') != '' && ele.val() == ele.attr('placeholder')) { | |
return ''; | |
} else { | |
return ele.val(); | |
} | |
} | |
return undefined; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment