Frage

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?

War es hilfreich?

Lösung

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

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top