I want to cancel any links and add extra attributes to each one. Below is how I've achieved this.
function anularEnlaces(){
$('nav a').each(function(){
var href = $(this).attr('href');
var id = $(this).attr('id');
$(this).attr('href','javascript:void(0)');
$(this).attr('hrefnot',href);
$(this).attr('nivel','uno');
$(this).attr('seccion','dos');
});
}
My question is, is that a valid/recommended way to add custom atributes?