我验证图像路径是图像路径还是其他路径。如果是图像,则将特定的 href 值替换为#
但 # 值会影响所有链接。如何将图片链接替换为#
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', '#');
}
});
});
这里是
任何建议都会很棒。