Bug Tracker

Opened 14 years ago

Closed 13 years ago

Last modified 12 years ago

#5163 closed enhancement (fixed)

$("#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:


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)

Change History (5)

comment:1 Changed 14 years ago by shangxiao

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

comment:2 Changed 14 years ago by shangxiao

Test script:

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

comment:3 Changed 13 years ago by dmethvin

Component: unfiledattributes

comment:4 Changed 13 years ago by dmethvin

need: ReviewCommit
Owner: set to dmethvin

comment:5 Changed 13 years ago by john

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.