jQuery using .html() but needing to exclude an element -


i'm using .html() pull list of <li>'s div need exclude li id of #donate-link

at current jquery is

var _topbarmenu = $("<div/>").attr({         "id": "topbarmenu",         }).append($('.tabs').html())         .prepend("<li id='shop-link'>"+_pm+"</li>"); 

as can see i'm pulling data in using $('.tabs').html() , have tried $('.tabs').html().not('#donate-link') not seem work .

edit content

var _topbarmenucontent = $('#header .tabs').html(); $(_topbarmenucontent).find('#donate-link').remove(); var _topbarmenu = $("<div/>").attr({     "id": "topbarmenu",     })  .append(_topbarmenucontent)         .prepend("<li id='shop-link'>"+_pm+"</li>"); var _topcontent = $("<div/>").append(_topbarlogo).append(_topbarmenu); $(_topbar).append(_topcontent);  $("#wrap").prepend(_topbar); $(window).scroll(function(e){     if ($(window).scrolltop() > 170) {         console.log('>10');         $(_topbar).slidedown();     } else if ($(window).scrolltop() == 0) {         console.log('0');         $(_topbar).slideup();     } else {         console.log('0');         $(_topbar).slideup();     } }); 

html

    <ul class="tabs">         <li id="shop-link" class="garage-link"><a href="/board" class="mainmenu" original-title="visit board"><span>board</span></a></li>         <li id="shop-link" class="garage-link"><a href="./garage.php" class="mainmenu" original-title="visit virtual garage"><span>garage <i>[beta]</i></span></a></li>         <li id="shop-link" class="upload-an-image"><a href="#" original-title="upload image"><span>upload image</span></a></li>         <li id="shop-link"><a href="/board/merch" original-title="purchase items enthst store"><span>store</span></a></li>         <li id="members-link"><a href="./memberlist.php" original-title="view complete list of members"><span>members</span></a></li>         <li id="donate-link"> <a href="#" target="_blank" original-title="donate"><span>donate</span></a></li>   </ul> 

edit jsfiddle added

jsfiddle

this should work:

$('.tabs').not('#donate-link').html()

your code didn't work because html returns string not jquery object can chained.

good luck


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -