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

css - I want to align grid in center -

python - SWIG function not printing output -

oop - Function for all prototypes - Javascript -