today, i was going through the jquery selectors section and tried an animation using recursion. Using call backs, i was able to do the "blinking" of text in a lable. When a button is clicked, I update the lable with current date and time (new Date()), but the default text was set again after the click and new Date display. When I went through forums, I found a solution. ie., using "e.preventDefault()" to be called in the click event. Using that prevented me to call the $(document).ready every time any event occurs in the page....
$(document).ready(function () {
BlinkLabelSample("lblSample");
});
function BlinkLabelSample(elem) {
var obj = $("#" + elem);
obj.fadeIn("1000", function () {
$(this).fadeOut("1000");
BlinkLabelSample("lblSample");
});
}
$("#btnAnimationChange").live("click", function (e) {
$(":animated").text(new Date());
e.preventDefault();
});