Answer the question
In order to leave comments, you need to log in
Cloning an element and the next one after it?
target = $(this).clone().wrap('<p>').parent();
that's how it works;
target = $(this).clone().wrap('<p>').parent() + $(this).next().clone().wrap('ul').parent();
Syntax error, unrecognized expression: [object Object][object Object]
Answer the question
In order to leave comments, you need to log in
It gives a correct error, because it will not work to concatenate two objects. If you want to take only the text from these objects and concatenate it, you will most likely need 3 variables.
var per1 = $(this).clone().wrap('<p>').parent().text(),
per2 = $(this).next().clone().wrap('ul').parent()text(),
target = per1 + per2;
var per1 = $(this).clone().wrap('<p>').parent().text(),
per2 = $(this).next().clone().wrap('ul').parent()text(),
target = Namber(per1) + Namber(per2);
Maybe this suits you
var target = $(this).clone().wrap('').parent().add($(this).next().clone().wrap('ul').parent( ))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question