AJS*_*ift 3 jquery add href hyperlink
如何使用jquery在下面的链接值中添加一些地址?例如http://maps.google.com/maps?q=indianapolis
<div class="driving-directions-link">
<a href="http://maps.google.com/maps?q=">Get Direction</a>
</div>
Run Code Online (Sandbox Code Playgroud)
$("div.driving-directions-link > a").prop("href", function (index, oldHref) {
return oldHref + "indianapolis";
});
Run Code Online (Sandbox Code Playgroud)
退房.prop,这可以采取功能哪里oldHref好,旧href.
示例: http ://jsfiddle.net/c5VNK/
| 归档时间: |
|
| 查看次数: |
2961 次 |
| 最近记录: |