data filter jQuery
var $previous = $('.navlink').filter(function() {
return $(this).data("selected") == true
});
Matteoweb
var $previous = $('.navlink').filter(function() {
return $(this).data("selected") == true
});