2016-08-04 25 views

回答

2

一个简单的选择类似下面应该为你工作。

$('#background_image').attr('xlink:href','newurl.com/image.png');   
+0

乐意帮助:) – Yasser

1

使用jQuery的.attr()更新href

$(function() { 
 
    $('#background_image').attr('xlink:href', 'http://placehold.it/350x150'); 
 
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<image id="background_image" width="804" height="943" preserveAspectRatio="xMinYMin" style=" pointer-events:none;background-repeat:repeat-y;" xlink:href="http://www.example.com/img/imag.png">

+1

您需要SVG元素... – Kaiido