diff options
Diffstat (limited to 'src/attributes.js')
-rw-r--r-- | src/attributes.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/attributes.js b/src/attributes.js index a76695b66..fd3e38ace 100644 --- a/src/attributes.js +++ b/src/attributes.js @@ -136,7 +136,7 @@ jQuery.fn.extend({ }, val: function( value ) { - if ( value === undefined ) { + if ( !arguments.length ) { var elem = this[0]; if ( elem ) { @@ -209,9 +209,10 @@ jQuery.fn.extend({ val = value.call(this, i, self.val()); } - // Typecast each time if the value is a Function and the appended - // value is therefore different each time. - if ( typeof val === "number" ) { + // Treat null/undefined as ""; convert numbers to string + if ( val == null ) { + val = ""; + } else if ( typeof val === "number" ) { val += ""; } |