I don't know whether it is pasting problem while posting the code or not, but there are some problems.
"<a href="" class="remove" title="Remove this item">"></a> " +
Here the underlined part is extra. And there is no text for the link so I have added that. Now the code is working fine. Means alert is coming and the tr is getting removed.
Below is the total code what I have tried. It is working fine. You can check.
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#cart-grid").append("<tr class = 'cart_table_item'> " +
"<td class='product-remove'> " +
"<a href='' class='remove' title='Remove this item'>Remove</a></td> " +
"<td class='product-thumbnail'> " +
"<a href='Item_desc.aspx?itmid=" + 1 + "'> " +
"<img width='90' height='90' src='wp-content/uploads/90x90/" + "test" + "' class='attachment-shop_thumbnail wp-post-image' /> " +
" </a></td> " +
"</tr>");
$(".remove").on("click", function (e) {
alert("asd");
//var href = $(this).attr('href');
$(this).closest("tr").remove(); // remove row
return false;
});
});
</script>
</head>
<body>
<div id="cart-grid"></div>
</body>
</html>