Question: I am changing the image on a `UISlider` thumb as follows:

```
[mySlider setThumbImage:thumbRegular forState:UIControlStateNormal];
[mySlider setThumbImage:thumbActive forState:UIControlStateHighlighted];

```

When I scrub, it all works as I expect, but when my finger falls off the thumb while scrubbing (drags outside), the thumb image changes back to "thumbRegular", even though the scrubbing itself continues normally. (And changes back to "thumbActive" as the dragging comes back inside).

Any ideas on how to correct this behaviour? Or is it expected behaviour?

Answer: 
You need to do this -

```
$(this).attr('id');

```
When the click handler is executing, jQuery has made sure to set `this` to the DOM element that triggered the event. That means that you can use

```
alert(this.id)

```

to access the `id` attribute. This is because the [`id` attribute is exposed like this](http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-63534901) — no jQuery involved.

You can also choose to use [jQuery's `attr` method](http://api.jquery.com/attr/) instead:

```
alert($(this).attr("id"))

```

This way you construct a jQuery object from `this`, and then proceed to use the `attr` method on that object. Note, that `$(this)` won't have an `id` attribute.