【发布时间】:2018-05-15 09:42:00
【问题描述】:
如何使用 jQuery 更改超链接的 href?
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("a").each(function(){
var href = $(this).attr('href');
alert(href);
var reg =href+'hiii' ;
alert(reg);
$(this).attr("href", reg);
alert($(this).text())
});
});
</script>
<button>Alert the value of each list item</button>
<ul>
<a href="yuyuyuyuyuy"><p>If you click on me, I will disappear.</p></a>
<a href="ioooo"><p>If you click on me, I will disappear.</p></a>
</ul>
这就是你可以改变甚至编辑链接工作的方式,以便在网站上编辑附属链接删除 jquery alart
【问题讨论】:
标签: jquery