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

114
Views
How can you point an HTML object's data attribute to an in-line SVG?

My site reuses the same 3 JS-animated clickable SVGs on each of a page's 63 post elements, and they seem to take forever to load/seriously hinder page performance. (Slow performance happens while using 3*63 separate HTML objects to pull in the same 3 external SVGs).

I'm trying to reduce my site's load time by only loading them once (either as an object w/ data attribute pointed to an external SVG file, or by loading them in the HTML as an in-line SVG), and then referencing their ID tag in an another object's data attribute, but this doesn't seem to work.

I made two example CodePens linked above to illustrate the issue, and copied the code from the external version below.

The end goal is just to reduce code (vs in-lining all 63*3 SVGs), and to improve performance/reduce loading times.

If I'm going about this the wrong way, please show me a better way to do this.

<object id="likeButton" type="image/svg+xml" data="https://www.charliemoody.com/s/likeButton.svg">
</object>

<object class="likeButtonClones" type="image/svg+xml" data="#likeButton">
</object>
about 4 years ago · Juan Pablo Isaza
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!