Skip to content

Instantly share code, notes, and snippets.

@richardkundl
Created March 27, 2013 14:19
JQuery read textbox placeholder member, if the textbox value is empty. Thats wrong. This rVal return empty value, never return placeholder value.
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