mercredi 17 septembre 2014

jQuery wrap with html comment tags


Vote count:

0




I already tried 3 solution but didn't work.


I want to wrap my sidebar with comment tags.


First solution:



$("#sidebar").wrap("<!--googleoff: index--><!--googleon: index>");


Second solution:


From this post: jQuery comment/uncomment <!--element-->



function comment(element){
element.wrap(function() {
alert(this.outerHTML);
return '<!--googleoff: index-->'+this.outerHTML+'"<!--googleon: index>';
});
}
comment($('#sidebar'));


Third solution:



$('#sidebar').prepend("<!--googleoff: index-->");
$('#sidebar').append("<!--googleon: index>");


the result I want:



<!--googleoff: index--> //start comment tags
<div id="sidebar"></div>
<!--googleon: index> // tags


asked 1 min ago

Jows

69






jQuery wrap with html comment tags

Aucun commentaire:

Enregistrer un commentaire