aboutsummaryrefslogtreecommitdiffstats
path: root/src/attributes.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/attributes.js')
-rw-r--r--src/attributes.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/attributes.js b/src/attributes.js
index c239dd7f3..5396a90e5 100644
--- a/src/attributes.js
+++ b/src/attributes.js
@@ -165,7 +165,13 @@ jQuery.fn.extend({
return ret;
}
- return (elem.value || "").replace(rreturn, "");
+ ret = elem.value;
+
+ return typeof ret === "string" ?
+ // handle most common string cases
+ ret.replace(rreturn, "") :
+ // handle cases where value is null/undef or number
+ ret == null ? "" : ret;
}
return undefined;