Event delegation.
$(e.target).closest('ol, ul');
It's also possible to use live, but I don't see much purpose in that
since even more unnecessary events will be caught.
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]
Fabio_Floripa wrote:
> ok, so if dind't use the ID's
>
> how can i go back only using the tags...
> thinking that i can have more tage <ol> <ul> on teh same page
> how can i go back from <li> tag to the <ol>
> on my example?
>
> thanks again
>
> On May 16, 8:19 am, Ricardo <[email protected]> wrote:
>
>> Is that the real mark-up you're using? IDs are unique so you should't
>> have any other #list elements to choose.
>>
>> On May 15, 5:06 pm, Fabio_Floripa <[email protected]> wrote:
>>
>>
>>
>>
>>> Hi quick help
>>> how can i go back to one selecotr in the hierarchy
>>> eg:
>>> <ul id="selector">
>>> <ol id="list">
>>> </ol>
>>> <br>
>>> <ul id="itens">
>>> <li>test 01</li>
>>> <li>test 02</li>
>>> <li>test 03</li>
>>> </ul>
>>> </ul>
>>> when i click on the LI tag
>>> its will be add same item on teh OL tag
>>>
>>> with this
>>> $("#selector ul li").click(function () {
>>> $str_option = $(this).text();
>>> $( "#list").append( "<li>" + $($str_option).selector + "</li>" );
>>>
>>> this work fine
>>> but if i have more those codes on the page... how can i use something
>>> without selector
>>> $( "#list")
>>>
>>> can i uset the
>>> $(this)
>>>
>>> and back to a parent id?- Hide quoted text -
>>>
>> - Show quoted text -
>>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---