Is there something in jQuery to uniquely identify a DOM node, if the HTML markup does not provide an id, i.e. if $(NODE).attr("id")
returns undefined
?
Goal: exclude a specific node of a specific class.
jQuery(document).ready(function($){
$(".accordion-right-content").hide();
$(".article-image img").click(function() {
$(".accordion-right-content").each(function(i,v) {
// the following comparison does not work because of the missing ID
if ($(v).attr("id") !== $(this).parent().parent().children(".accordion-right-content").attr("id")) {
$(v).hide();
} else {
$(v).show();
}
});
});
Except the specific $(this).parent().parent().children(".accordion-right-content") to be hidden before shown again.