我可能遗漏了一些非常明显的东西,但不知何故我正在努力计算跨度标签内的字符。跨度是动态填充的,我试图获取它的长度,包括空格,以调整列的宽度。如果我只运行 text() 或 html() 我可以得到内容:
<span id="vlen00">someword</span>
vlenght = $('#vlen00').text();//vlenght is assigned 'someword'
vlenght = $('#vlen00').html();//this also gives me 'someword'
但是当我尝试将其调整为:
vlenght = $('#vlen00').text().lenght;//that gives me 'undefined'
vlenght = vlenght.lenght;//that also gives me 'undefined'
谢谢!