Bug Tracker

Opened 11 years ago

Closed 11 years ago

Last modified 8 years ago

#4495 closed bug (invalid)

$('#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.

Change History (4)

comment:1 Changed 11 years ago by tw2080

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;

},

comment:3 Changed 11 years ago by dmethvin

If you want the value of an input element, use .val() and not .text()

comment:4 Changed 11 years ago by dmethvin

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