I'm trying to get the html of an element except for one of its children.

I've tried this based on other questions [1][2] (etc), but the :not selected does not appear to work on my case.

See this: http://jsfiddle.net/GyKr6/1/

In this case, this works as expected

$("#previewLink .toRemove").remove();

But I want the resulting html.

What am I doing wrong?

有帮助吗?

解决方案

$("#previewLink").clone().find(".toRemove").remove().end().html();
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top