Reputation: 9959
My generated Html markup is
<ul class="list">
<li class="tile" id="row-5">
</li>
</ul>
My AJAX post is
$.post("/Faq/Delete", { "id": recordToDelete},
function (data) {
var row = "row-" + data;
$(row).fadeOut('slow');
});
But when i call $(row).fadeOut('slow');
the selected line is not removed.
What am i doing wrong here?
Assume the recordToDelete value equals 5.
Upvotes: 0
Views: 81
Reputation: 133403
You need to prefix #
to use ID Selector (“#id”)
var row = "row-" + data;
$('#' + row).fadeOut('slow');
//^^^ Add #
OR
var row = "#row-" + data;
//^^^ Add #
$(row).fadeOut('slow');
Upvotes: 6