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

197
Views
replace multiple <p> with arrays

first i was able to change
<p id="test">here what i want to replace</p>
to <p id="test">successfully replaced</p>
with

var txt1 = "successfully replaced"; document.getElementById('test').innerText = txt1;

and now i want to replace multiple <p> but with effective/shortway using arrays, like this

var txt1 [success1:"successfully replaced 1",
      success2:"successfully replaced 2",
      success3:"successfully replaced 3"];

but when i reload the browser i didn't see any changes on that <p>
i just started learning javascript last week so I'm still not sure about that

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

0

Use a JavaScript object as a dictionary to get the new value for each p tag.

jsfiddle: https://jsfiddle.net/bd35xov9/8/

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!