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

128
Views
Insert label values in divs with a class

I want to insert all label values in my p class rowSvar. I tried this script undereath but I get both answers in my p tag. How do I only get each answer?

<div class = "rows">
 <div class = "row" id = "rowOne">
   <p>Förväntas deltagarna arbeta kreativt?</p>
   <p class = "rowSvar"></p>
   <p></p>
   <p></p>
 </div>
 <div class = "row" id = "rowTwo">
   <p>Vad är huvudmålet med mötet?</p>
   <p class = "rowSvar"></p>
   <p></p>
   <p></p>
 </div>
var labels = $('#from :checked').map(function() {
return $(this).closest('label').text();
}).get();

  labels.forEach(function(e) {  
    $('.rowSvar').append(e);
  });
about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

You should specify which .rowSvar should receive which answer. $('.rowSvar') selects multiple elements, each element should get the appropriate answer, I'm assuming your labels are ordered exactly as your .rowSvars are.

labels.forEach(function(e, index) {  
  $('.rowSvar')[index].append(e);
});
about 4 years ago · Santiago Gelvez 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!