In the slide callback, the 'this' argument is the corresponding DOMElement,
on which .slider() was called. This is true of all jQuery and jQuery UI
callbacks. It's always a DOMElement, and it's always the one for that event.
So you can have one callback function

function handleSlide(event, ui) {
  var id = $(this).attr("id");
}

and use it for three sliders:

$("#slider1, #slider2, #slider3").slider({
  slider: handleSlide
});

- Richard

On Tue, Mar 10, 2009 at 12:54 PM, Michael B. Williams <[email protected]>wrote:

>
> Is it possible for the "slide" event to figure out the id of the
> element it is associated to?
>
> For example, I am making a list of sliders that all have essentially
> the same functionality. However, when a user slides one it should
> update an input field with a value. The input field it updates depends
> on which slider. So, the slide callback needs to be able to figure out
> which element it was originally create on.
>
> Thanks
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to