[jQuery] Re: JQuery css selector
$('#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/444img src=http://example.com/images/ checked.gif//a a href=/items/makeActive/444Make Active/a /li li id=delete_item a href=/items/delete/444img src=http://example.com/images/ unchecked.gif //a a href=/items/delete/444Delete/a /li li /li /ul /span /div /code Thanks everyone, ocptime
[jQuery] Re: JQuery css selector
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/444img src=http://example.com/images/ checked.gif//a a href=/items/makeActive/444Make Active/a /li li id=delete_item a href=/items/delete/444img src=http://example.com/images/ unchecked.gif //a a href=/items/delete/444Delete/a /li li /li /ul /span /div /code Thanks everyone, ocptime
[jQuery] Re: JQuery css selector
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/444img src=http://example.com/images/ checked.gif//a a href=/items/makeActive/444Make Active/a /li li id=delete_item a href=/items/delete/444img src=http://example.com/images/ unchecked.gif //a a href=/items/delete/444Delete/a /li li /li /ul /span /div /code Thanks everyone, ocptime
[jQuery] Re: JQuery css selector
$('ul li').click(function(){ /* ... stuff ... */ }); will bind soem code to the click event on all ul li elements, but you'll probably want to pass it some kind of unique identifier otherwise you'll get screwy results and be unable to do anything meaningful with the function. On May 18, 10:34 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/444img src=http://example.com/images/ checked.gif//a a href=/items/makeActive/444Make Active/a /li li id=delete_item a href=/items/delete/444img src=http://example.com/images/ unchecked.gif //a a href=/items/delete/444Delete/a /li li /li /ul /span /div /code Thanks everyone, ocptime
[jQuery] Re: JQuery css selector
$('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/444img src=http://example.com/images/ checked.gif//a a href=/items/makeActive/444Make Active/a /li li id=delete_item a href=/items/delete/444img src=http://example.com/images/ unchecked.gif //a a href=/items/delete/444Delete/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 -~--~~~~--~~--~--~---
[jQuery] Re: JQuery css selector
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/444img src=http://example.com/images/ checked.gif//a a href=/items/makeActive/444Make Active/a /li li id=delete_item a href=/items/delete/444img src=http://example.com/images/ unchecked.gif //a a href=/items/delete/444Delete/a /li li /li /ul /span /div /code Thanks everyone, ocptime
[jQuery] Re: JQuery css selector
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/444img src=http://example.com/images/ checked.gif//a a href=/items/makeActive/444Make Active/a /li li id=delete_item a href=/items/delete/444img src=http://example.com/images/ unchecked.gif //a a href=/items/delete/444Delete/a /li li /li /ul /span /div /code Thanks everyone, ocptime
[jQuery] Re: JQuery css selector
are you initiating the click()? $(function() { $(ul li).click(function () { alert(clicky, innit.); }); }); On May 18, 10:58 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/444img src=http://example.com/images/ checked.gif//a a href=/items/makeActive/444Make Active/a /li li id=delete_item a href=/items/delete/444img src=http://example.com/images/ unchecked.gif //a a href=/items/delete/444Delete/a /li li /li /ul /span /div /code Thanks everyone, ocptime
[jQuery] Re: JQuery css selector
$(function() { $(ul li).click(function () { alert(clicky, innit.); }); }); maybe take a look through the jquery tutorials here - http://docs.jquery.com/Tutorials On May 18, 11:07 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/444img src=http://example.com/images/ checked.gif//a a href=/items/makeActive/444Make Active/a /li li id=delete_item a href=/items/delete/444img src=http://example.com/images/ unchecked.gif //a a href=/items/delete/444Delete/a /li li /li /ul /span /div /code Thanks everyone, ocptime
[jQuery] Re: JQuery css selector
Take a look at this example: http://bjorsq.net/selector.html on 18/05/2009 11:07 ocptime said:: 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/444img src=http://example.com/images/ checked.gif//a a href=/items/makeActive/444Make Active/a /li li id=delete_item a href=/items/delete/444img src=http://example.com/images/ unchecked.gif //a a href=/items/delete/444Delete/a /li li /li /ul /span /div /code Thanks everyone, ocptime