Reputation:
I want to prepend this variable "logText" and make it fade in at the same time.
var logText = today + ":" + " " + document.getElementById("textBox").value + '<br>\n';
$("#logContent").prepend(logText);
Here is what I got but it doesn't work.
var logText = today + ":" + " " + document.getElementById("textBox").value + '<br>\n';
$("#logContent").prepend($(logText).fadeIn('slow'));
Upvotes: 1
Views: 102
Reputation: 21911
$("<p>" + today + ": " + $("#textBox").val() + "</p>") // new DOM Node
.css("display", "none") // hide it
.prependTo("#logContent") // prepend it to #logContent
.fadeIn("slow"); // fade it in slowly
Upvotes: 2
Reputation: 932
$("#logContent").prepend(today + ": " + $("#textBox").val() + '<br>').fadeIn('slow');
Upvotes: 0