Why not give them all a classname of editimage as well..
So you'd have something like
<a class="editimage" id="editimage1" />
...

Then you would do
$("editimage").click(function() {
   var num=this.id.substr(this.id.length-1);
   loadPopup("Image" + num);
});

not tested but i think thats what you want.


On Jan 16, 4:44 am, Peter <floranfe...@gmail.com> wrote:
> I have a load of buttons with almost similar names but with a number
> identifying them:
> id=editimage1
> id=editimage2
> id=editimage3
> id=editimage4
> etc.
>
> In the onclick event of these buttons I want to do something:
>     $("#editimage1").click(function() {
>                 loadPopup('Image1');
>         });
>
> Now I can place this function in my js files as many times as the
> button occurs, but that seem rather inefficient.
> I'd rather have a single function which I can reuse for all buttons,
> something like this pseudocode:
>
>     $("#editimage{imgId}").click(function() {
>                 loadPopup('Image{imgId}');
>         });
>
> Is that possible?
>
> Thanks!
-- 
You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to jquery...@googlegroups.com.
To unsubscribe from this group, send email to 
jquery-ui+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en.


Reply via email to