Considering we have
let existingSet = $();
How are newElements
added to that set by means of jQuery?
existingSet = existingSet.add(newElements);
is not an option, because I need the reference to this object. As well as $.extend
, because existingSet
may not be empty.
$.merge documentation says that it accepts array-likes, but provides no further explanation of that, I'm not sure if it is suitable for jQuery objects.
why not use prepend to add to beginning of set, and append to add new elements to end of set ?
$(myset).append('<div>New element here</div>')
or
$(myset).prepend('<div>New element here</div>')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.