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

183
Views
How to add css property to a span tag of an innerhtml

I have a innerhtml

Lets say

<p>
<span>8218819999</span>
<span>hello</span>
</p>

I want add css property for first span tag

How can I do that ?? Using jquery or javascript.

This whole html is coming from AEM Label which I don’t have control over.

Using ngafterviewinit I’m getting the innerhtml But not sure how to update the css.

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

0

const span = element.querySelector('p > span:first-of-type')

Add color style

span.style.color = 'red'
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!