I'm trying to find a simple, elegant way to create a "delete" button for a user's comments on a site I'm working on.

Ideally, I'd like to register an event handler for a class called something like "delcomment" and then assign a unique id to individual comments' delete buttons. Soemthing like the following:

```
<div>Wow really great post! <span class="delcomment" id="2350">delete</span></div>
<div>I think so too! <span class="delcomment" id="2351">delete</span></div>
<div>I think so too! <span class="delcomment" id="2352">delete</span></div>

```

And then use jquery to register an event handler for the class (somehow). This is what I'm trying to figure out how to do. This code works when elements are hardcoded HTML, but doesn't work when elements are added dynamically:

```
// register event handler for delcomment
$( "span.delcomment" ).click(function() {
    // some code that actually deletes comment from database
});

```

Any thoughts on best practice here? I would prefer to avoid any use of onclick="deleteComment(2350)" in each span, just to keep JS/JQ and HTML in separate sections of the document.