假设我有一个带有src ="img/highlow.png"的img元素.
怎么可以去掉alert('highlow');?
我有3个具有不同结构的href,并且它们都具有相同的硬编码参数(在此示例中值= somevalue-abc).
如何更新链接并使用新值覆盖值?
jQuery的
$(document).ready(function () {
$('a').click(function () {
var $newValue = 'newvalue';
//here a function that overwrites the parameter 'somevalue-abc' with $newValue
});
});
Run Code Online (Sandbox Code Playgroud)
HTML
<a class="demo" href="http://www.mydomain.com/page.aspx?demo&value=somevalue-abc">link 1</a>
<a class="real" href="http://www.mydomain.com/?value=somevalue-abc#go=yes">link 2</a>
<a class="outgoing" href="http://www.mydomain.com/page.aspx?value=somevalue-abc">link 3</a>
Run Code Online (Sandbox Code Playgroud)