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

150
Views
¿Cómo modificar el documento html dentro de div en jquery?

¿Cómo puedo modificar el documento HTML dentro de mi div en jQuery?

Este es mi código:

 $(".lastName").click(function() { val = $(".mydiv").clone(); //then before to append the 'val' in result class, i want it first to modify the label text from 'First Name' to 'Last Name' })
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <div class="mydiv"> <label class="label">First Name</label> <input type="text" class="myinput"> </div> <div class="result"></div> <button class="lastName">Last Name</button

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

0

Con html() , pero primero obtenga el nodo con .find('.label') e imprima el resultado $('.result').html(val)

 $(".lastName").click(function() { let val = $(".mydiv").clone(); $(val).find('.label').html('Last Name'); //then before to append the 'val' in result class, i want it first to modify the label text from 'First Name' to 'Last Name' $('.result').html(val) })
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script> <div class="mydiv"> <label class="label">First Name</label> <input type="text" class="myinput"> </div> <div class="result"></div> <button class="lastName">Last Name</button>

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!