Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

149
Vistas
How access value of nested html element with javascript/jquery

I have this piece of code:

   <td class="fieldValue " id="Contacts_detailView_fieldValue_leadsource" >
     <span class="value" data-field-type="picklist" >
      <span >Partner</span>
     </span>
   </td>

how do i access the value "Partner"? Thank you

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You can simply select the parent element and from there go to the child to get the innerHtml

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)
about 4 years ago · Juan Pablo Isaza Denunciar

0

I finally adopted this solution:

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'));

Thank you all for the suggestions!

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda