Hawver: You know what? I’ve applied that approach once myself. like, years ago.
Coutu: I remember struggling with the same issue for hours.
Donkervoet: Also you can swap body with whatever the parent element just make sure its laoded into the dom
Hotchkin: Yw.delgated events in the docs is where it explains it
Moccio: Hi. Any jquery validate plugin without form tag. please help.
Collison: Depending on your needs, it’s pretty easy to write yourself
Metzgar: I need generic code which can be used in multiple pages
Zavatson: Can’t you add the form tags? you can just prevent the regular submit
Thuman: Can someone tell me what the second line in this piece of code does: https://pastee.org/rpc5y ?
Policare: Kulelu88, https://en.wikipedia.org/wiki/%3F:
Brehony: So if orderList is NOT false/undefined/0/null then orderList will be === rderList.split’,’ otherwise it will be an empty array.
Valladores: Konrados: with that being said, can you tell me why/where my loading-items code is wrong here: https://pastee.org/bxm9c
Holdren: So orderList.split’,’ is splitting the array?
Wegener: This is my original function konrados : https://pastee.org/hntcz
Lukes: It split a *string*, so you get an array finally, kulelu88 – why do you think your code is wrong?
Schellenberge: If you’d like to see my JSFiddle, I can show you that as well
Suell: Konrados: because when I attempt to use the new method, it doesn’t render or renders incorrectly
Pittsinger: Kulelu88: localStorage is a key value store that can only store strings
Selic: So if you want to store structured data you have to convert it to and from a string
Floan: This is normally done as json though
Lupardus: Let me show you my JSFiddle Cork: https://jsfiddle.net/7x9x2cvd/
Norwood: Cork it seems he does store data as comma separated items, but I did not have a coffee yet.
Dermady: Ya, the storage is most likely done as .join’,’
Benker: That wasn’t what i meant by the “normally part”
Biss: Kulelu88: what part is failing for you?
Conrath: Cork: in the code rewrite: https://pastee.org/bxm9c . Using what should be proper jquery syntax eg. $.each for looping, my items are not rendering
Guarneri: No you NEVER append in a loop
Allenson: Cork: forgive me, but I am using code from other references.
Letterlough: Kulelu88: if you do .append in a loop you will force the browser to reflow the page on every append
Radziewicz: It is the most expensive action the browser has that doesn’t involve io
Fidel: So you want to build all new content and insert it in one go
Escalet: In this case you can replace empty + append with .html as that will replace everything
Staley: Secondly you should build a dom element and set text to it, else you get into the risk of xss
Graeter: The reason for the second change
Skurski: And it also makes the code more readable
Schucker: That said. the code i gave you is wrong.
Raviele: I hate that $.each and $.map has different attribute order.
Lavene: Btw you can rewrite orderList = orderList ? orderList.split’,’ : ;
Stallard: As orderList = orderList.split’,’ ;
Weyandt: Hmm actually you don’t need to hmm.
Doxon: It seems that when adding new items, they are not appended correctly as well
Hawf: Kulelu88: this code only handles restoring from localstorage
Bourquin: Btw the tip up there was wrong, ignore that
Behning: Forgot that getItem returns null if the key doesn’t exist