次の表記を使用します。
$('selector[attr]') // elements that has attribute attr
$('selector[attr=value]') // elements that has attribute attr with value `value`
$('selector[attr^=value]') // elements that has attribute attr starting with value `value`
$('selector[attr$=value]') // --~-- ending with `value`
$('selector[attr!=value]') // not equal `value`
$('selector[attr*=value]') // attribute contains `value`
$('selector[attr|=value]') // attribute has prefix `value`
$('selector[attr~=value]') // attribute contain word delimited by spaces
jquery 属性セレクターの完全なリストを参照してください
編集:あなたが尋ねている別のことがあるかもしれません:
特定の値のマップがあり、これを実行したい場合:
var map = { one: 1, two : 2 , three: 3 } ,
elem = $('.some'),
attr = elem.attr('id'),
nr = map[attr] // === 1