我有这行代码
$('.bartext').text(percentComplete + "%");
在html
它呈现像
<p class="bartext text" style="font-size: 14.020371290794092px;"></p>
但是console.log
的
console.log($('.bartext').text(percentComplete + "%"));
说
[p.bartext text, prevObject: x.fn.x.init[1], context: document, selector: ".bartext", jquery: "1.10.2", constructor: function…]
与outerHTML
_
"<p class="bartext text" style="font-size: 14.020371290794092px;">100%</p>"
和outerText
的
"100%"
编辑:整个部分
$.ajax({
xhr: function()
{
var XHR = new window.XMLHttpRequest();
XHR.addEventListener('progress', function(evt) {
if (evt.lengthComputable) {
var percentComplete = (evt.loaded / evt.total) * 100;
console.log(percentComplete);
$('.bar').css('width', (percentComplete * 2));
$('.bartext').text(percentComplete + "%");
}
}, false);
return XHR;
},
type: 'GET',
url: page,
data: {ajax : 1},
success: function(data) {
$('.content').empty().append(data);
}
});
到底是怎么回事?谢谢!!!:D