Skip to main content

Bug Tracker

Side navigation

#4495 closed bug (invalid)

Opened April 05, 2009 03:52PM UTC

Closed May 10, 2009 03:47AM UTC

Last modified March 13, 2012 04:47PM UTC

$('#inputElement').text() returns empty string in IE6

Reported by: tw2080 Owned by:
Priority: major Milestone: 1.3.2
Component: unfiled Version: 1.3.2
Keywords: IE6, text() empty string Cc:
Blocked by: Blocking:
Description

When I try to get the text value of a single input element in IE6, $('#inputElement').text(), an empty string is returned. In the same time document.getElementById('inputElement').value returns the correct value.

Attachments (0)
Change History (4)

Changed April 05, 2009 08:11PM UTC by tw2080 comment:1

A small change in the code at line 208 fixes this problemm:

(208) text: function( text ) {

var ret = "";

jQuery.each( text || this, function(){

if( this.childNodes.length > 0 ) {

jQuery.each( this.childNodes, function(){

if ( this.nodeType != 8 )

ret += this.nodeType != 1 ?

( this.value || this.nodeValue ):

jQuery.fn.text( [ this ] );

});

} else if ( this.nodeType != 8 )

ret += this.nodeType == 1 ?

( this.value || this.nodeValue ):'';

});

return ret;

},

Changed April 05, 2009 08:24PM UTC by tw2080 comment:2

Changed April 09, 2009 12:30AM UTC by dmethvin comment:3

If you want the value of an input element, use

.val()
and not
.text()

Changed May 10, 2009 03:47AM UTC by dmethvin comment:4

resolution: → invalid
status: newclosed