I want to do something like this:

```
var showLi = $("<li></li>");
$(showLi).append("<a href='#' class='showData'>Show</a>");
$($ul).append(showLi);
$(showLi+" a.showData").click(function(){
 alert("clicked");
});

```

the above code is giving error when I used the selector for adding **click** method.
What can be other way to do this?

Thanks