$('ul li').click(function(){ /* ... stuff ... */ }); will bind code to the click event on all ul li elements in the document, but you'll probably want to pass it some kind of unique identifier otherwise you may end up triggering the code when you don't want to since all li would trigger the same code, and you'd be unable to do anything meaningful with the function because all the li clicks would do exactly the same thing.
On May 18, 10:50 am, ocptime <mail.samgeo...@gmail.com> wrote: > Hi, > > It's not working :). > How can i select using the jquery ul li selector? > > Thanks > ocptime > > On 18 May, 13:39, Peter Edwards <p...@bjorsq.net> wrote: > > > $('#delete_item a').click(function(){ > > return (confirm('Are you sure?')); > > }); > > > This will only work if there is one item to delete on the page because > > it uses an ID selector. > > If you have multiple items, use a class selector instead. > > > on 18/05/2009 08:43 ocptime said:: > > > > Hi everyone, > > > > How can I use the jQuery css selector on click function when the user > > > clicks on the delete <img> > > > or the delete < a href> tag? > > > > <code> > > > <div id="ribbon"> > > > <span class="right"> > > > <ul> > > > <li> > > > <a href="/items/makeActive/444"><img src="http://example.com/images/ > > > checked.gif"/></a> > > > <a href="/items/makeActive/444">Make Active</a> > > > </li> > > > <li id="delete_item"> > > > <a href="/items/delete/444"><img src="http://example.com/images/ > > > unchecked.gif" /></a> > > > <a href="/items/delete/444">Delete</a> > > > </li> > > > <li> </li> > > > </ul> > > > </span> > > > </div> > > > </code> > > > > Thanks everyone, > > > ocptime --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery (English)" group. To post to this group, send email to jquery-en@googlegroups.com To unsubscribe from this group, send email to jquery-en+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-en?hl=en -~----------~----~----~----~------~----~------~--~---