This forum is now read-only. Please use our new forums! Go to forums
banner
Close banner
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
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();
Popular free courses
- Free Course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner friendly,4 LessonsLanguage Fluency - Free Course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner friendly,11 LessonsLanguage Fluency - Free Course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner friendly,6 LessonsLanguage Fluency
1 comments
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.