Pregunta

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?

¿Fue útil?

Solución

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

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top