對不起,jQuery完全不熟悉。我想知道如何獲得title屬性並將其附加到href標記的內部html中。我無法修改html源代碼,但我必須能夠將標題文本附加到href標記內的文本末尾。感謝幫助社區。jQuery如何顯示標題屬性並附加到內部html
<script style="text/javascript">
$(document).ready(function()
{
$("#part4 > a").mouseover(function() {
$(this).next().html(("#part4 > a").attr("title")).toggle();
});
$("#part4 > a").mouseout(function() {
$(this).next().html(("#part4 > a").attr("title")).toggle();
});
});
</script>
<div id="part4">
<h2>4: Link and Title Attribute Demo</h2>
<a href="#" id="linkTitle" title="This is text from the title attribute, wrapped in a span tag, placed here by jquery.">
Hover over this text</a>
</div>