Tengo este fragmento de código:
<td class="fieldValue " id="Contacts_detailView_fieldValue_leadsource" > <span class="value" data-field-type="picklist" > <span >Partner</span> </span> </td>¿Cómo accedo al valor "Socio"? Gracias
Simplemente puede seleccionar el elemento principal y desde allí ir al elemento secundario para obtener el HTML interno
const value = document.querySelector(".value") const partner = value.children; // partner[0] is for taking the first element // and then .innerHTML is for the content inside console.log(partner[0].innerHTML)Finalmente adopté esta solución:
function textSpan(id){ const collection = document.getElementById(id); const value = collection.children; const final = value[0].children[0].innerText; return final; }console.log(textSpan('Contacts_detailView_fieldValue_leadsource'));¡Gracias por todas las sugerencias!