Opened 12 years ago
Closed 11 years ago
#6221 closed bug (fixed)
Internet Explorer and NULL val()
Reported by: | Vic D'Elfant | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | |
Component: | manipulation | Version: | 1.4.2 |
Keywords: | null val | Cc: | |
Blocked by: | Blocking: |
Description
Internet Explorer appears to be treating NULL as the string "null" when passed to an element's value property (or .val(), for that matter). If data is - for example - retrieved through AJAX and then passed to input fields to pre-fill a form, it is very impractical to check for NULL and run .val() on every call.
The attached patch improves the val() function by checking for NULL and setting this.value to an empty string if this is the case. The behaviour for non-null values remains untouched.
Attachments (1)
Change History (5)
Changed 12 years ago by
Attachment: | internet-explorer-null-vals.diff added |
---|
comment:1 Changed 12 years ago by
I would say this is a bug, since this means val() is not cross-browser for null values. I vote for this one.
comment:2 Changed 12 years ago by
Keywords: | null val added |
---|---|
Milestone: | 1.4.3 → 1.5 |
Priority: | → low |
Status: | new → open |
Type: | enhancement → bug |
The patch is a nice help, so I'll push this through, but if you want to add a reduced test-case on a jsfiddle account, it may speed up the process of fixing this.
Switching to bug since it seems to be a crossbrowser inconsistency.
comment:3 Changed 12 years ago by
Whilst posting the test case, I found out that this bug only affects 1.4.2 and appears to be fixed in 1.4.3:
http://www.jsfiddle.net/hNhtX - 1.4.3 http://www.jsfiddle.net/hNhtX/1 - 1.4.2
It works just fine in the latter.
Patch