Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

271
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

0

You need to fix the attribute class enclosed with ":

<div class="row onerow"></div>
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda