我是一個新的訪問者,並且在jQuery中相對較新。在圖像上覆制並操作ALT
我有,我想顯示,在SPAN,圖像下方,並操縱,以取代ALT文字圖像「 - 」用B和I-標籤...
電流HTML:
<span class="alignright">
<img src="sys/billeder/medarbejdere/tommy_stor.jpg" width="162" height="219" title="Name - Age" />
<span></span>
</span>
通緝輸出
<span class="alignright">
<img src="sys/billeder/medarbejdere/tommy_stor.jpg" width="162" height="219" title="Name - Age" />
<span><b>Name</b> <i>Age</i></span>
</span>
我已經使用這個jQuery來提取ALT,並把它放在SPAN:
var alt = $("#hoejre p span img").attr("alt");
$("#hoejre p span span").text(alt);
提取工程就像一個魅力,但我需要的SPAN:
...to start with "<b>"
...to replace the "-" with "</b> <i>"
...and end with "</i>"
這就像一個魅力 - 謝謝你... – 2010-03-11 12:25:31