Binding click events to append()'d links

Binding click events to append()'d links

Hi everyone.

The short of it: I'm making a sessions shopping cart and using jQuery to create the list of items as <li>'s that are appended to a <ul>. Each <li> has a link at the end that I want the user to be able to click on to remove this <li> from th <ul>.

I'm scratching my head when it comes to referencing a hyperlink (a href) that has been added to the page after the dom is loaded. The user adds <li>'s to an <ul> via a form. This part works.

I need help with two things.

1). Binding the same click event to a newly created link
2). When clicking a link, the event handler needs to call a generic function that has an identifier passed to it that specifies the <li> and removes it.

If you read the paragraph above twice, it makes sense!!! I basically want the user to be able to add and remove items in the most unobstrusive way using jquery.

Cheers in advance for you help!

S