セットアップであるプロパティ リスト (マイ ショートリスト) のさまざまな種類の動作を処理する関数があり<ul><li>
ます。<li>
動作の 1 つのタイプは、各アイテム内のボタンをクリックしたときにプロパティ リスト アイテムを削除することですif
。これは正常に機能していますが、すべてのアイテムが削除されたことを確認する私のステートメントは機能していません。
私が間違っていることを教えてもらえますか?onclick
ボタンのイベントと危険なif
ステートメントを介してアイテムの削除を処理する関数の一部を次に示します。
// Remove an item from the shortlist
$(this).find('.btn-minus').click(function() {
var btnRemove = $(this);
var propTile = $(this).parents('.property-tile');
var propList = $('#property-listings');
// If IE 8 / 7
if ($('html').hasClass('lte8')) {
propTile.hide('slide', 300, function() {
btnRemove.data("tooltip").hide();
});
}
// All other browsers
else {
propTile.fadeOut(200, function() {
btnRemove.data("tooltip").hide();
$(this).remove();
});
}
if (propTile.length === 0) {
propList.remove();
}
});
関数の呼び出しは次のとおりです。 $(".my-shortlist").myShortlist();
where.my-shortlist
は<ul>
要素です。
ありがとう