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

270
Views
HTML JS , Append a new div to html body

i wanna add a new div,created with js, to the html file.I use cpanel as storage.

html

<div class="row onerow"></div>

js

 $( "<div></div>" ).appendTo( ".onerow").addClass("col")

I wanna save that new div i just created on the html body.Right now the div is deleted on page refresh.

Full story: I have to create a website that contains a one row gallery.I wanna create a script where the admin can upload a photo and that photo will join the row as a new col.Upload is ready,but now i have to figure how to save the col to html body.Thank you for your time!

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

0

First of all you have a little html error.

You should change your div as below

<div class="row onerow"></div>

and your jQuery code:

$(document).ready(function() {
  $('.onerow')
    .append('<div>new div</div>')
    addClass('abc');
});

And here is a demo for your case https://jsfiddle.net/gfLajh07/

about 4 years ago · Juan Pablo Isaza Report

0

You need to fix the attribute class enclosed with ":

<div class="row onerow"></div>
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!