我甚至不確定這是否可能,但讓我們走了。jQuery:爲元素添加標題屬性並從以下元素插入文本
我有這樣的HTML動態地爲每個圖像生成:
<a href="image.jpg" class="thickbox">
<img src="thumb.jpg" title="This is the title" alt="" />
</a>
不知怎的,我需要從thumb.jpg title屬性並將其複製到周圍的錨,這將使這個結果:
<a href="image.jpg" class="thickbox" title="This is the title" alt="">
<img src="thumb.jpg" title="This is the title" alt="" />
</a>
如果可以用jQuery來實現,我會很高興。
在此先感謝。
工作完美。快速響應的榮譽! – Miker
不要忘記接受答案。 – Barmar