jquery - Excluding element from selection -


i need select html block exclude 1 div specific class.

<div id="myhtml">     <p>...</p>     <div>...</p>     ... more html here     <div id="exludeme">         ...     </div> </div> 

so i'm trying use .not() no luck...

$("#myhtml").not('#exludeme').html(); 

what missing? because it's withing selected block of html? how bump out?

not() excludes elements initial selection, not descendants of in selection.

you should make clone if don't want alter original, can go on find elements desire, remove them, , html of previous element set (#myhtml):

var html = $("#myhtml").clone().find('#exludeme').remove().end().html(); 

jsfiddle


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -