如何在javascript对象“ this”中访问“ textContent”或“ innerText”?

时间:2019-06-22 19:16:43

标签: javascript innertext

我有下一个“ this” javascript对象:

this: tr#23.odd.filaResaltada
accessKey:""
align:""
assignedSlot: null
attributeStyleMap: StylePropertyMap {size: 0}
attributes: NamedNodeMap {0: id, 1: role, 2: class, id: id, role: role, class: class, length: 3} 
autocapitalize:""
baseURI:"http://localhost/lira/obraSocial/mostrarObrasSociales"
id:"23"
innerHTML:"<td class="sorting_1">23</td><td>Prueba Prueba</td><td>123456789</td><td>1</td>"
innerText:"23   Prueba Prueba   123456789   1"
inputMode:""
isConnected:true
textContent:"23Prueba Prueba1234567891"
title:""
translate:true
vAlign:""

是否可以使用javascript访问textContent或innerText元素?

这是我到目前为止尝试过的:

function accionClick(){
        var id_fila = $(this).attr('id'); //This does work
        var textContent = $(this).attr('innerText'); //This does not work
}

0 个答案:

没有答案