Instead of writing this a bunch of times (which works):
$('.this--class:contains("Some text")').parent().clone().appendTo($(".other--class"));
$('.this--class:contains("Other text")').parent().clone().appendTo($(".other--class"));
$('.this--class:contains("More text")').parent().clone().appendTo($(".other--class"));
If trying to figure out if I can put the text items into an array and then loop through them using jQuery and then have it clone to the .other--class.
My example:
var items = [
"Some text",
"Other text",
"More text"
];
$.each(items, function (index, value) {
$(".this--class:contains(value)").parent().clone().appendTo($(".other--class"));
}
If I do a console.log(value); I can see it kick out the correct items in the console. I'm just not sure of the correct way to have :contains() recognize that text, or if I need to go about this differently.
Overall just looking of an easier way to not have to write the same thing over and over.