To put it simple...
I have element clone. Its div with some other tags saved in it. It also have .x in it.
I need to remove it and then apped that modified element to another element.
Unfortunately, it doesn't work. Remove failed or something, but .x is still in it.
clone = subtitle.clone(); // Works!
no_label = clone.remove('.x'); // This fails.
more_subtitles.append(no_label); // Its appends no_label, but it still contains .x element.
That's because remove() removes the matched elements from the DOM. Even if you pass a selector, it's only used to filter these elements. In your code, clone matches a single element (the cloned subtitle) which doesn't expose the x class.
You can use find() to match the .x element:
more_subtitles.append(subtitle.clone().find(".x").remove().end());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With