javascript - Change the Image Link to "#" using jQuery -
i validate image path whether image path or other path. if image replace particular href value # # value affected links. how can replace image link #
jquery(document).ready(function($) { $("a").each(function(i, el) { var href_value = el.href; if (/\.(jpg|png|gif)$/.test(href_value)) { jquery('a').prop('href', '#'); } }); }); here
any suggestion great.
use this
jquery(this).prop('href', '#'); or
jquery(el).prop('href', '#');
Comments
Post a Comment