I have the following input elements:
I use to solve this with the class selectors which don't need to be unique.
This also has a positive effect on speed because no complex search is required Additionally you can use this for the different styling of different elements
e.g.
element type aa
element type aa
element type aa and bb
element type bb
Now you can simply use the class selector
$('.aa').click(function(){
console.log( 'clicked type aa #' + $(this).attr('id') );
});
$('.bb').click(function(){
console.log( 'clicked type bb #' + $(this).attr('id') );
});