这是我必须使用的,html输出是从CMS生成的,我真的没有选择修改生成它的PHP:
<ul class="mylist">
<li class="item1"><a href="#">List Item 1</a></li>
<li class="item2"><a href="#"><img src="image.png"></a></li>
<li class="item3"><a href="#">List Item 3</a></li>
</ul>
我需要更换第二项
<img src="image.png>
有这样的事情:
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" width="69.212px" height="44.023px" viewBox="0 0 69.212 44.023" enable-background="new 0 0 69.212 44.023" xml:space="preserve"><g><path d="M2.959 30.254c1.262 0.688 3.495 1.417 5.63 1.417 3.106 0 4.563-1.296 4.563-2.916 0-1.701-1.213-2.632-4.368-3.604 -4.223-1.256-6.213-3.2-6.213-5.548 0-3.159 3.058-5.75 8.105-5.75 2.378 0 4.466 0.567 5.776 1.215l-1.068 2.592c-0.922-0.486-2.621-1.134-4.805-1.134 -2.524 0-3.932 1.215-3.932 2.673 0 1.62 1.407 2.349 4.465 3.321 4.077 1.296 6.165 2.997 6.165 5.912 0 3.442-3.204 5.872-8.786 5.872 -2.572 0-4.951-0.526-6.601-1.336L2.959 30.254z"/><path d="M24.412 14.298l4.611 11.015c0.777 1.782 1.408 3.402 1.893 5.022h0.146c0.534-1.62 1.213-3.24 1.99-5.022l4.563-11.015h4.465l-9.222 19.601H28.78l-8.931-19.601H24.412z"/><path d="M65.862 14.298c-0.097 1.417-0.194 2.997-0.194 5.386v11.379c0 4.495-1.067 7.249-3.349 8.95 -2.281 1.782-5.582 2.349-8.542 2.349 -2.815 0-5.922-0.567-7.814-1.62l1.067-2.713c1.553 0.81 3.98 1.539 6.893 1.539 4.369 0 7.572-1.903 7.572-6.844v-2.187h-0.097c-1.311 1.822-3.834 3.28-7.475 3.28 -5.825 0-9.999-4.131-9.999-9.557 0-6.642 5.194-10.408 10.582-10.408 4.077 0 6.31 1.782 7.329 3.402h0.097l0.194-2.957H65.862zM61.445 22.033c0-0.607-0.048-1.134-0.243-1.62 -0.776-2.065-2.864-3.766-5.97-3.766 -4.077 0-6.989 2.875-6.989 7.411 0 3.847 2.33 7.046 6.941 7.046 2.621 0 5-1.377 5.921-3.645 0.243-0.607 0.34-1.296 0.34-1.903V22.033z"/></g></svg>
我已经尝试过.replaceWith功能,但我无法使用它。我需要将它替换为svg标签而不是img标签,以便用CSS进一步修改SVG。
任何帮助都非常感谢!