[jQuery] Wildcard selector AND pass the selector to a sub-function?
Hi, I have a situation where the same javascript is repeated about 50
times - just with a differnt ID. Example:
$('#mydiv1').change(function() {
doStuff('#mydiv1');
});
$('#mydiv2').change(function() {
doStuff('#mydiv2');
});
...
$('#mydiv50').change(function() {
doStuff('#mydiv50');
});
Is there a way to combine all these calls using wildcards?? I imagine
it would be something like:
$('#mydiv<* as foo>').change(function() {
doStuff('#mydiv<foo>');
});
Any help would be greatly appreciated.