Skip to main content

Bug Tracker

Side navigation

#6221 closed bug (fixed)

Opened March 04, 2010 01:06PM UTC

Closed April 01, 2011 01:00AM UTC

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 (4)

Changed September 23, 2010 08:44AM UTC by kwikwag comment:1

I would say this is a bug, since this means val() is not cross-browser for null values. I vote for this one.

Changed October 23, 2010 09:44PM UTC by SlexAxton comment:2

keywords: → null val
milestone: 1.4.31.5
priority: → low
status: newopen
type: enhancementbug

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.

Changed October 24, 2010 07:54AM UTC by Vic D'Elfant comment:3

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.

Changed April 01, 2011 01:00AM UTC by dmethvin comment:4

resolution: → fixed
status: openclosed

Fixed in 1.4.3.