dado
dado

Reputation: 54

Replace a link HTML with non existing tag

I have images that opens in lightbox. I'm trying to make one image not open in lightbox. Best way to do it, is if I change <a href...></a> to <b href></b>, so it doesn't have function, span what ever.

My jQuery:

$('.post-101 a').replaceWith(function () {
    return $('.post-101 b', {
        html: $(this).html()
    });
});

Upvotes: 0

Views: 58

Answers (2)

Pete
Pete

Reputation: 58432

You can unbind all events using .off()

$('.post-101 a').off();

Upvotes: 4

Matej Žvan
Matej Žvan

Reputation: 766

Broken html is not a good idea. Try catching the click event and stop it form going to lightbox plugin.

Something like this might work.

$( "a.no-lightbox" ).click(function( event ) {
  event.stopPropagation();
});

More info on jQuery docs

Upvotes: 2

Related Questions