Reputation: 1680
Is there any way of changing the text of a div whilst a highlighting effect is taking place, and then revert back to the original text once it has finished?
Code for initiating the highlight effect:
$("#myDiv").effect("highlight", {}, 3000);
Upvotes: 1
Views: 633
Reputation: 5655
Try this.
var myDiv=$("#myDiv");
myDiv.data("old",myDiv.html());
myDiv.html("New text");
myDiv.effect("highlight", {}, 3000, callback);
function callback(){
var myDiv=$("#myDiv");
myDiv.html(myDiv.data("old"));
}
Upvotes: 2