The jquery selector has a second parameter 'context':
http://docs.jquery.com/Core/jQuery#expressioncontext

such that if defined it will only select what's a descendant of that
element.
You can also use find():
http://docs.jquery.com/Traversing/find#expr

By the way, what is ui.item? An object? (Class/ID) String?

On Oct 13, 12:49 am, Matt <guitarroman...@gmail.com> wrote:
> Hi all,
>
> Writing a sortable list function.
>
> My <li> elements contain several items (headings, paragraphs etc) and
> I want to add a class to the headings when they've been sorted.
>
> I have this code in my sortable init:
>
>            receive: function(event, ui) {
>                         $(ui.item).addClass('editable');
>                 },
>
> This adds class="editable" to my newly-sorted <li> element - cool.
> What I want, though, is to add this class to the <h3> within my <li>.
> I tried:
>
>            receive: function(event, ui) {
>                         $(ui.item + ' h3').addClass('editable');
>                 },
>
> but this just gave a syntax error.
>
> Is there a way to do this?
>
> Thanks,
> Matt

Reply via email to