现在div文本被更改为"text"我需要将其更改为链接中的"data-text".
<a href="1884.html" class="brieflink" data-src="article.jpg" data-text="text4">Brief 4</a>
<div id="brieftext"><p>Text to be replaced</p></div>
$("a.brieflink").bind("mouseover", function() {
$("div#brieftext").text("text", $(this).data("text"));
});
Run Code Online (Sandbox Code Playgroud)
$("div#brieftext").text($(this).attr("data-text"));
Run Code Online (Sandbox Code Playgroud)
我学到了:
$("div#brieftext").text($(this).data("text"));
Run Code Online (Sandbox Code Playgroud)
也将在1.4之后工作,感谢@Rocket.
| 归档时间: |
|
| 查看次数: |
11702 次 |
| 最近记录: |