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

161
Views
jQuery Insert .after() is inserting as a string not HTML

I have my element selected like so

let btn = $("a[translate='server.ipmi.kvm.LAUNCH']")[0];

Then when attempting to insert after it i'm doing the following

btn.after('<a class="btn btn-default" onclick="launchNewKvm()">New KVM</a>')

This is inserting the content as a string for some reason and not as a button as I'd like, If I wrap this as a jQuery element then it inserts as [object Object]

any ideas at all would be appreciated

Inspect Element after running the .after

almost 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Here you use after method of javascript, not jquery, which if you need to insert an HTML, it should be a DOM Node or it will be treated as text.

If you want to use jquery after method, then don't get the index

let btn = $("a[translate='server.ipmi.kvm.LAUNCH']");

btn.after('<a class="btn btn-default" onclick="launchNewKvm()">New KVM</a>')
almost 4 years ago · Santiago Trujillo 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!