I would use .prevAll’.

 
Derenzo: So when you replace the content you remove everything

Vajgrt: Cork: ok, I guess it will be around 20 images each in 10 nested sortables galleries 200 images in total

Hautala: I think i’ve used like 150 without having any problem so ya that should work fine

Montecalvo: Cork, thanks. How you suggest going about with this please

Underkoffler: Baako: well you could replace part of the accordion content instead of all of it

Waldorf: Or you could move the part you don’t want to replace out of it

Pawluk: Cork, if i move the part i dont want out of it then it doesnt get that jquery ui accordion style if you get what i mean

Gampong: Baako: ok then you have to target the accortion part you want to replace

Megrabyan: Instead of replacing all of it

Schiraldi: Cork, how will you do it? what is the logic you will use please

Kirchgessner: Well you would have to select the elements you want to replace

Pester: And ex. insert the new html before it and then remove the old

Marak: Cork, in this case the element to select might be the template id

Szuba: If you do you can never reuse the template

Bodziony: Cause it will be gone

Artiaga: Well unless you reload

Jarboe: The template element is response for this {{type}} {{cardno}} exp{{exp_month}} / {{exp_year}}

Mihalak: At times like this i wish i had a bit or knowledge of jquery seem am having to spend more time doing it seen the front end guy isnt here anymore

Broughton: Cork, after selecting the element

Nierenberg: I will choose to seleect the template id

Whitelaw: Baako: i would recommend moving the template out of the accoridon and make it into a script type=”text/template” element

Dunigan: What i dont understand Cork is that the div id=”template” is not wrapped with within div id=”NewCardContainer”

Hohnson: No point in making it visible in the page

Dauphin: Baako: the problem isn’t with template, it is with id=”accordion”

Battista: So when you replace the content of #accordion you replace everything

Curzi: I guess this is where that happens accordion.htmlsimplate2data, template .accordion{ icons: icons };

Lataquin: Isnt they a walk around?

Benziger: Cork, https://jsfiddle.net/baako/07w55tyj/5/

Daubendiek: Inside a .closest how do I do a wildcard?

Fiscel: Just like in standard jquery selector?

Battig: Though wildcard is prob not very usefull cause that would match the current element too

Diiorio: Cork: sorry, with wildcard I meant basically this id=editor-

Rydzewski: So I find the element starting with editor- that is closest to my current element

Rizzardi: Xatenev: ugg. you should never do that

Strouse: Cause you should use a cl*** if you want to group elements

Breaux: Not use an id as an attribute

Gehron: Attribute selectors are SLOW

Schaffeld: Cork: I cant change the HTML tbh

Metzker: Elm id=”editor-12″ = elm id=”editor-12″ cl***=”editor”

Sennett: Cork: the HTML is generated by a 3rd party api

Lapin: Cork: and then included into our layout

Kamph: Cork: It doesnt work aswell tho

Nevil: Always quote values in attribute selectors

Berthelette: Hm thats undefnied still

Crocetti: Cork: http://hastebin.com/agufezufut.xml can you take a quick look maybe

Adelsperger: I wanna retrieve the element one above

Czapski: Xatenev: why not just closest’td’ ?

Postlewaite: Or you mean you wanted the sibling?

Nevius: I would use .prevAll’.tinymce-input’ for that