you can select multiple objects in the selector, like: $ ("#obj1,#obj2,#obj3").change(...)
On Sep 15, 7:42 am, cgp <cgpala...@gmail.com> wrote: > I have 2 or more objects that onclick(), will call the same function. > Right now I have the following: > > .... > $("#obj1").change( function() { > setupPage();}); > > $("#obj2").change( function() { > setupPage();}); > > $("#obj3").change( function() { > setupPage();}); > > .... > > I was wondering if there is a way to simplify or clean up the code, > since they are all doing the same thing and responding to the same > event. This is just for refactoring reasons because my code is getting > too long/messy. > > Thanks.