This forum is now read-only. Please use our new forums! Go to forums

banner
Close banner
0 points
Submitted by Teesh Yalamanchili
over 8 years

9/14 - trying to make ('li') .selectable and it's not working

Hi guys. Trying to experiment a bit to increase my understanding and so i thought I’d try to make the (‘li’) .selectable . I copied the –ol .ui-selected– section in the css and duplicated it by replacing the “ol” with “li”

Then I replaced the $(‘ol’) with $(‘li’) in the script and it doesn’t do anything. Can anyone help me understand this better so I know why that doesn’t work.

Thanks.

Answer 55d78ce89113cb46960003da

0 votes

Permalink

This selector,

ol .ui-selected { }

targets descendant elements, namely LI. If we write,

li .ui-selected {}

we are now targeting descendant elements of LI, which are text nodes, not elements. We can write this,

li.ui-selected {}

and it will work so long as we leave the jQuery alone:

$('ol').selectable();
points
Submitted by Roy
over 8 years

1 comments

Teesh Yalamanchili over 8 years

I see what you’re saying Roy. li.ui-selected {} seems to have the same overall effect as it’s not toggling only when i click on the text but rather anywhere in the ‘ol’ area. So I think I understand what you’re talking about here.