Discussion of this bug: http://groups.google.com/group/jquery-en/browse_thread/thread/9a7e4a989106f57b/b5bbedf927fab901?lnk=gst&q=rsyring&rnum=2#b5bbedf927fab901
Summary Follows
The docs say that .text() is similar to .html() except that all the html formatting gets stripped out. However, .text() does not operate the same way as .html() when given a number object instead of a string.
Live Example:
http://rcs-comp.com/code_examples/text_function_bug/
I have some code that has a three column table in it. When the user
updates some number values in one of the two columns, I have some JS
that sums those columns and updates the value in the third column with
that info. When updating the third column, which his a TD element, I
tried to use text() to do it:
var total = col1Total + col2Total;
$('#wi_medical_total').text(total);
However, that did not work because the text in the cell never seemed
to get updated. So, I I changed the code to use .html() instead
of .text() :
var total = col1Total + col2Total;
$('#wi_medical_total').html(total);
and it worked just fine. So, I did some more playing and came up with
this:
var total = 5 + 5 + 'p';
$('#wi_medical_total').text(total);
Which finally worked and changed the text correctly to "10p". FYI,
"p" was just a random character.