Reputation: 839
Right now the div text is being changed to "text" I need it to be changed to the "data-text" from the link.
<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"));
});
Upvotes: 1
Views: 11739
Reputation:
$("div#brieftext").text($(this).attr("data-text"));
I have been learned:
$("div#brieftext").text($(this).data("text"));
will also work after 1.4, thanks @Rocket.
Upvotes: 8
Reputation: 2497
$.text()
takes one argument only. Try:
$("div#brieftext").text( $(this).data("text") );
Upvotes: 1
Reputation: 227310
.text()
only takes 1 parameter.
$("div#brieftext").text($(this).data("text"));
Upvotes: 2