No entiendo lo que sucede cuando haces una cadena de .show() s así. Tampoco escribí este código o tengo una idea de cómo descubrir lo que está sucediendo aquí. De ahí esta pregunta.show(). Parent(). Show() - ¿Qué está pasando aquí?
// Remove favorite category
$(".FavoriteRemove").click(function() {
var cat = $(this).parents(".Category"); //the parent of the clicked item is the category/bundle
var catid = $(this).attr("catid"); //the id tag on the clicked item is the BundleID
$.post($(this).attr("href"), function() { //the href tag is the post URL for adding a favorite
cat.remove(); //here we remove the category/bundle
//*** WHAT IS THIS DOING? v
$(".Category[catid=" + catid + "]").show().parent().show();
//*** NO THAT UP THERE^
if ($(".FavoriteCategories div").length == 0)
$(".FavoriteCategories").hide();
//bindCategories();
});
return false;
});
¿Alguien puede describir lo que significa? Soy consciente de que el objetivo es la clase 'Categoría' con un atributo que coincide con la ID, pero no entiendo qué significa la cadena de funciones.
Gracias.
+1 por mencionar la interfaz fluida; Creo que esa es la fuente de la confusión aquí. –
+1 interfaz fluida – RichardTheKiwi
Muy buena explicación. Mucho más completo que el mío.+1 – user113716