.each

by helpinspireme

HTML

<a rel="0">0</a>
<a rel="1">1</a>
<a rel="2">2</a>
<a rel="3">3</a>
<a rel="4">4</a>

JavaScript

var x = 2;

$('a').each(function(){
    var _this = $(this);
    if (_this.attr('rel') == x) {
        _this.hide();
    } else {
        // else
    }
});