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

242
Views
¿Cómo borrar texto solo, no otros elementos claros por jquery?

 $(document).ready(function(){ $(".final-step").text(" "); });
 <div class="final-step">i will be remove only <span class="">i will not remove</span> <i class="">me too</i></div>
intento esto pero elimina todos los elementos

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

0

Prueba esto Puede ser esto te ayudará

 $(document).ready(function(){ var f = $(".final-step").html(); var h = $(".final-step").contents().first(); var g = f.replace(h.text(), ""); $(".final-step").html(g) });
 <div class="final-step">i will be remove only <span class="">i will not remove</span> <i class="">me too</i></div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

about 4 years ago · Juan Pablo Isaza Report

0

Aquí hay una solución en un JS puro

 const element = document.getElementsByClassName("final-step")[0] let childNodes = element.childNodes for (let node of childNodes){ if (node.nodeName == '#text'){ document.getElementsByClassName("final-step")[0].removeChild(node) } }
about 4 years ago · Juan Pablo Isaza Report

0

Aquí hay una solución en JQuery. ¿Es lo que necesitabas?

 $(document).ready(function(){ var text = $('.final-step span').text(); $(".final-step").text(text); });
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <div class="final-step">i will be remove only <span class="">i will not remove</span> <i class="">me too</i></div>

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!