Objective:
I am working on a website on square space, in which I want to remove a div and want to show it into another div.
My effort so far:
I have tried to find solutions from the below SO links, but it didn't help me
- cut a div and html inside it and paste it into a different div with jquery
- cut and paste html to other element
- cut completely and paste an element
What I want to do is, in the image below:
you can see in the image, as I want to cut the "SOLD OUT" text from the bottom, and want to paste on the top of the image
I am using jQuery for that, my code
var soldList = $('div .grid-meta-status').get();
var itemsList = $('div .hentry').get();
for(var i=0; i<soldList.length; i++)
{
if( soldList[i].innerText == "SOLD OUT" )
{
var item = $('div .grid-meta-status').get(i);
$("div .grid-meta-status:nth-child(2)").remove();
$("<div class='grid-meta-status'><div class='product-mark sold-out'>sold out</div></div>").filter(function( index ) {return $( "div .grid-meta-status" ).text() == "SOLD OUT"}).insertBefore(" .grid-image");
//$("<div class='grid-meta-status'><div class='product-mark sold-out'>soldd out</div></div>").insertBefore(".grid-image");
}
}
website link https://trumpet-nonagon-ek9j.squarespace.com/originals