Move Div Up with Jquery

Asked

Viewed 166 times

0

Hi, I have a Divs configuration on a crud and wanted to put the div I create dynamically above a UL that contains the send buttons. It is not possible to place this manually via html as the screen is automatically generated via Jformer. I wanted to put the "fields" Ivs on top of the UL "Jformercontrol"

inserir a descrição da imagem aqui

via jquery I can’t.

$(".jFormerControl").append('.campos');
$(".campos").append(".jFormerControl");

I tried for these commands but did not roll. Someone has already gone through this and can help me ?

1 answer

0


Try something like that:

var $campos = $(".campos");
var $formerControl = $(".jFormerControl");
$formerControl.append($campos);
  • now stayed inside the div, but UL still stands for first :|

  • To stay before any other element use the "preppend".

  • use then $formerControl.preppend($fields); ?

  • That. Just by correcting, it is "prepend" with only one p. http://api.jquery.com/prepend/

  • It worked here, thanks (:

Browser other questions tagged

You are not signed in. Login or sign up in order to post.