我想做的enter code here
是将div中的H2标签替换为.location
使用jQuery的类。我怎样才能做到这一点?
我想改变他们两个。URL 或/和名称。两者任一。谢谢。
<div class="location">
<h2><a href="#">United States</a></h2>
<h3>lorem ipsum...</h3>
<ul>
<li>Addresss</li>
<li>Address 2</li>
<li>Phone: xxx</li>
<li>Fax: xxx</li>
</ul>
</div>
<div class="location">
<h2><a href="#">Europe</a></h2>
<h3>lorem ipsum...</h3>
<ul>
<li>Addresss</li>
<li>Address 2</li>
<li>Phone: xxx</li>
<li>Fax: xxx</li>
</ul>
</div>
$('.location h2').replaceWith('<a href="#"><h2>Europe</h2></a>');
但它改变了两个位置名称