<span></span>
is replaced by <a></a>
<span class="hidden-link" data-link="cart.html"><span id="total-cart-count" class="badge"></span></span>
$('.hidden-link').replaceWith(function(){
return'<a href="'+$(this).data('link')+'">'+$(this).html()+'</a>';
})
<noindex></noindex>
not satisfied?$(this).html()
this.outerHTML
innerHTML
outerHTML
commented on June 8th 19 at 17:02$('.hidden-link.basket').replaceWith(function(){
console.log('$(this).html()');
console.log($(this).html());
console.log('this.outerHTML');
console.log(this.outerHTML);
console.log('this.innerHTML');
console.log(this.innerHTML);
return '<a class="basket" href="' + $(this).data('link') + '">' + $(this).html() + '</a>';
});
commented on June 8th 19 at 17:08Find more questions by tags JavaScriptHTML
So it is impossible? - Izabella commented on June 8th 19 at 17:03