Tengo una lista de divs todos con la misma clase, quiero aplicar una función a todos los que no son los clics (this
), ¿cómo puedo seleccionar !this
con jQuery?¿Cómo seleccionar un elemento que no es 'esto'?
ACTUALIZACIÓN: He hecho esto y no está funcionando, ¿alguna idea de por qué?
$("li").each(function(){
$("li").not(this).click(function(e) {
$(this).hide();
});
});
ACTUALIZACIÓN 2: este es todo el código real:
$(".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();
});
});
});
que no funciona causa que está diciendo: 'LI (cada uno), pero no LI -> hide' –
es' this' aquí incluye todos los ' li' elementos? no solo el que hizo clic? ¿De qué otra forma puedo obtener solo el 'li' cliqueado? – ilyo
¿Qué es 'newStatus'? – thecodeparadox