すべて同じクラスのdivのリストがありますが、クリックされたもの()ではないすべてのdivに関数を適用したいのですが、jQuerythis
でどのように選択できますか?!this
更新:私はこれを作成しましたが、機能していません。なぜですか?
$("li").each(function(){
$("li").not(this).click(function(e) {
$(this).hide();
});
});
更新2:これは実際のコード全体です:
$(".mark").click(function(e) {
e.preventDefault();
var id = "#" + $(this).parent().parent().parent().parent().attr("id") + " ";
var currentStatus = "deleted"; // to be replaced with actual status
var currentStatusClass = "." + currentStatus + "-heading";
$(id + currentStatusClass).show();
$(id + ".edit-headings").click(function(){
$(this).find(".headings-status").show().addClass("bg-hover");
$(id + ".headings-status").click(function() {
$(id + ".headings-status").not(this).hide();
});
});
});