Skip to main content

Bug Tracker

Side navigation

#5163 closed enhancement (fixed)

Opened September 03, 2009 06:15PM UTC

Closed September 24, 2010 09:58PM UTC

Last modified March 13, 2012 03:26PM UTC

$("#id").val(null) sets string "null" as value in IE

Reported by: maltalef Owned by: dmethvin
Priority: minor Milestone: 1.4.3
Component: attributes Version: 1.4.2
Keywords: val null string ie Cc:
Blocked by: Blocking:
Description

this is actually a bug in IE (tested in IE8 with compatibility mode on) that should be covered by jQuery.

document.getElementById("someTextInput").value = null

incorrectly assigns a string "null" as opposed to what happens in non-substandard browsers (ie an empty string is assigned). This behavior should be standardized when calling

$("#someTextInput").val(null)

Attachments (0)
Change History (5)

Changed September 15, 2009 05:58AM UTC by shangxiao comment:1

Yep I've come across the same issue. It'd be nice if jQuery could cover this quirk ;) Thx!

Changed September 15, 2009 06:02AM UTC by shangxiao comment:2

Test script:

<html>
<head>
<script src="jquery.js"></script>
<script>
$(document).ready(function() {
    $('#test').val(null);
    alert($('#test').val() === "null");
});
</script>
</head>
<body>
<input type="hidden" id="test" value="" />
</body>
</html>

Changed June 13, 2010 05:29PM UTC by dmethvin comment:3

component: unfiledattributes

Changed August 21, 2010 02:35AM UTC by dmethvin comment:4

Changed September 24, 2010 09:58PM UTC by john comment:5

milestone: 1.41.4.3
resolution: → fixed
status: newclosed
version: 1.3.21.4.2