OrElse
OrElse

Reputation: 9959

JQUERY Fade out, not working as expected

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

Answers (1)

Satpal
Satpal

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

Related Questions