Problem
Can't get prependTo()
and slideDown()
functions work together.
Short
Please take a look at the code.
http://jsfiddle.net/tt13/5CxPr/53/
Press "new" to see what happens
Am I missing something?
Detailed
Here is JS code
function newrow(elem){
if($("#"+elem+"s").is(":hidden")){
$("#"+elem+"s").slideDown("slow")
}
$('<tr />').addClass(elem).append(
$('<td />').text('new row')
).prependTo("#"+elem+"s").slideDown("slow");
}
$(document).ready(function() {
$(".new").click(function() {
newrow($(this).attr("id").replace("add_",""))
});
});