Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

152
Views
Cómo acceder al valor del elemento html anidado con javascript/jquery

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

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

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

0

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!

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!