문제

I need to get the content a cell in a one-column table. When I use .innerText I lose the last empty character. Here is my code :

When I want to display my object (raw) :

console.log(myRow);

I get (with last character of cell empty) :

<tr class="t-state-selected">
    <td>Some data </td>
</tr>

But when I want the innetText :

console.log("'" + myRow.innerText + "'");

I get :

'Some data'

Why am I losing this last empty space ? How can I get all the data?

도움이 되었습니까?

해결책

Try using .textContent instead of .innerText which trims it.

Or if you need <IE9 support you could perhaps use .innerHTML

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top