Question: I have this jQuery which works fine

```
$("li[id^='shop_id']").click( function () {

  alert("I clicked on id ??");

 });

```

The above will work if any list element with an id beginging with 'shop\_id' is clicked (i.e 'shop\_id\_1', 'shop\_id\_2', etc).
The problem is that I don't know how to find out exactly which id was clicked. I need to know as I need to set the visability of other elements depending on which id was clicked.

Any ideas ?

Thanks

Answer: 
The "this" variable will help you out here:

```
$("li[id^='shop_id']").click( function () {
    var current_id = $(this).attr("id");
    alert(current_id);
});

```
```
<script type="text/javascript">
  $("li[id^='shop)id']").click(function(){
    alert($(this).attr('id'));
  });
</script>

```