html-lists

Get Element in HTML Ordered List by Index Using Javascript

隐身守侯 提交于 2019-12-11 18:59:59
问题 I looked quite a bit for a solution for this but I surprisingly couldn't find anything. Maybe I just didn't search for the right words. I found a bunch of questions about getting the index by the element, but I need the opposite. I'm trying to use javascript and jquery get an element in an ordered list by it's index in the list. For example, if I have this list: <ol> <li>Zero</li> <li>One</li> <li>Two</li> <li>Three</li> </ol> I would like to be able to get the first one ( Zero ) by its index

Checkbox click not working from within unordered list item

☆樱花仙子☆ 提交于 2019-12-11 18:18:51
问题 I am unable to 'check' an input checkbox that is embedded in an expandable UL. I know the reason has something to do with click binding but I just can't figure it out. The UL is dynamic so I add new li's and UL's. The lowest level UL contains lis that should be selectable. However when I try to click on them it just highlights the label and the checkbox never becomes checked. Here's the HTML: <li id="JeffID4" class="collapsed expanded"> Assessment <ul class="inputs-list" style="display: block

Append two images randomly from array into 'li's with javascript

隐身守侯 提交于 2019-12-11 16:35:51
问题 I am basically trying to dynamically add an Array of images randomly into their own li elements, which is working fine, but what I really want to do now is append a second image per list element. I'm not sure how this would work. Here's my working randomiser script which shuffles the array order: var imgs = ['img-1.jpg','img-2.jpg','img-3.jpg','img-4.jpg','img-5.jpg','img-6.jpg']; var i = imgs.length, j, tempi, tempj; while (i--) { j = Math.floor(Math.random() * (i + 1)); tempi = imgs[i];

Horizontal Menu ul align right and align left

吃可爱长大的小学妹 提交于 2019-12-11 16:27:22
问题 I've searched through everything and can't seem to find an exact fix for this. It seems pretty simple but I've been beating my head against a wall lately trying to get it just right. I have a simple horizontal menu on a website. I am using an UL to make it all work. Here is my code: > <div id="nav"> > <ul> > <li><a href="#">Home</a></li> > <li><a href="#">company</a></li> > <li><a href="#">Products</a></li> > <li><a href="#">Services</a></li> > <li><a href="#">Involvement</a></li> > <li><a

Custom numbering for a reversed ordered list

落花浮王杯 提交于 2019-12-11 14:42:33
问题 How can I create custom counter styles for a reversed ordered list: C10. Item 10 C9. Item 9 C8. Item 8 C7. Item 7 C6. Item 6 C5. Item 5 C4. Item 4 C3. Item 3 C2. Item 2 C1. Item 1 I found this link which perfectly describes how to achieve a custom numbering in ascending order. How can I modify the following to get a reverse custom numbering and apply it to only a specific listing? <!DOCTYPE html> <html> <style> ol.cp { counter-reset: item; margin-left: 0; padding-left: 0; } ol.cp li { display

How to check if a list is ordered?

烂漫一生 提交于 2019-12-11 13:50:00
问题 I am doing some unit tests and I want to know if there's any way to test if a list is ordered by a property of the objects it contains. Right now I am doing it this way but I don't like it, I want a better way. Can somebody help me please? // (fill the list) List<StudyFeedItem> studyFeeds = Feeds.GetStudyFeeds(2120, DateTime.Today.AddDays(-200), 20); StudyFeedItem previous = studyFeeds.First(); foreach (StudyFeedItem item in studyFeeds) { if (item != previous) { Assert.IsTrue(previous.Date >

CSS - HTML Lists - center UL in page & left align LI items

流过昼夜 提交于 2019-12-11 13:20:02
问题 I have this code: .menu { margin: auto; padding: 0; list-style-type: none; } .item { width: 60px; text-align: center; font-size: 4em; background-color:red; display: inline-block; margin: 5px; padding: 25px; } <ul class="menu"> <li class="item">1</li> <li class="item">2</li> <li class="item">3</li> <li class="item">4</li> <li class="item">5</li> <li class="item">6</li> <li class="item">7</li> <li class="item">8</li> <li class="item">9</li> <li class="item">10</li> </ul> I want to center align

Adding icon to <li> menu

和自甴很熟 提交于 2019-12-11 13:08:07
问题 i am working on a school project and I am stuck at a point where i want to put an image ( >><< ) inbetween <li> -tags. Because it's a navigation in wordpress it's done in php. Here is what i have: img http://img825.imageshack.us/img825/253/screenshot20120529at305.png Here is what i want (look at the blue thingies in between the menu items): img http://img703.imageshack.us/img703/253/screenshot20120529at305.png I think this is the php where i need to put my image/menuitem.png.. but where? Help

Nested loop in Thymeleaf

半城伤御伤魂 提交于 2019-12-11 12:49:06
问题 I'm a newbie to Thymeleaf. I have two objects- Classroom & Student : each Classroom contains a List<Student> and I can have a list of classrooms: List<Classroom> . What I want to be able to do with Thymeleaf is the equivalent of the below java code: for(int i = 0; i < classroomList.size(); i++){ System.out.println(classroomList.get(i).getRoomName()); for(int x = 0; x < studentList.size(); x++){ System.out.println(studentList.get(x)); } } So the output would be: {classroom1{joe1,joe2},

jquery hover not working on my list items

﹥>﹥吖頭↗ 提交于 2019-12-11 12:15:19
问题 I am going thru a strange problem,I added hover function to my list items which are generated dynamically using ajax, but nothing is happening.The code is executing without any errors but with no effect.Even the alert is not displaying for mouseenter and mouseout.The alert pops up once in a while but not everytime.I am using the following code. $('.category_list li').live("mouseenter", function() { alert('I m here'); $(this).find('.category_list').css('text-decoration','underline'); }).live(