Not claiming this is any more elegant, but using filter() on a collection allows much more flexibility on what you can match on, and is a little less error prone than string concatenation.
var matching = $('.selectedColumns a').filter(function(){
return $(this).attr('attributeid') == 41
});
matching.prop('selected', true);
There's no need for the :
or double =
in your attribute-equals selector, it should just be:
$('.selectedColumns a[attributeid=' + $(this).val() + ']');
Also if you're using invalid attributes, consider using data- attributes which are valid in HTML5, for example data-id
instead of attributeid
.
use a single = instead of 2. Also, the : shoudn't be there afaik
var link = $('.selectedColumns a[attributeid=' + $(this).val() + ']');