Try this with attribute-starts-with-selector /
$('select[id^="begin"]').each(function () { console.log(this.id); });
or you can use attribute-ends-with-selector
$('select[id$="end"]').each(function () { console.log(this.id); });
Update
To select the first 3 you can use :lt(3) , like this
$('select[id^="begin"]:lt(3)').each(function () { console.log(this.id); });
Demo
Update
To combine selectors you can do this
$('select[id^="begin"][id$="end"]').each(function () { console.log(this.id); });
Demo
If you want to select an element with an identifier starting at the beginning of OR , you can do this using, to get two different selectors
$('select[id^="begin"],select[id$="end"]').each(function () {
Demo
Anton
source share