html-lists

Search based on list item class

瘦欲@ 提交于 2020-01-03 04:35:09
问题 I'm not too familiar with anything beyond writing markup and CSS, and I have a question.. If I have one .html page with a structure like this: <ul> <li></li> <li></li> <li></li> </ul> Now let's assume each of these list items has a class assigned to it, but the class is not unique, and is used multiple times. Is it possible to fetch all list items based on a certain class to another .html page? For example, summon all list items with class "red" to a page called red.html, and all items with

Recursive UL LI to PHP multi-dimensional array

痞子三分冷 提交于 2020-01-03 03:12:10
问题 I'm trying to convert an HTML block which is basically in the following form (each list item should be on one line, so there shouldn't be any lines containing <ul><li> if you see what I mean): <ul> <li>Item 1</li> <li> <ul> <li>Item 2</li> <li>Item 3</li> </ul> </li> <li>Item 4</li> </ul> But it could be several layers deep. I basically want to convert it to a multidimensional array, where the contents are the value (the actual contents are a bit more detailed, but I should be able to process

Count li elements that are visible with jQuery

泄露秘密 提交于 2020-01-01 02:48:12
问题 Im counting my li elements with the following jQuery script: HTML: <ul class="relatedelements"> <li style="display:none;" class="1">anything</li> <li style="display:none;" class="2">anything</li> <li style="display:none;" class="3">anything</li> </ul> jQuery: $(function() { var numrelated=$('.relatedelements > li').length; $('.num-relatedelements').html(numrelated); }); --> The script returns: 3 I change the style="display: none" property of some of the li elements when $(document).ready with

Use jQuery to move WordPress post attachments to per-post dynamically-created lists?

假如想象 提交于 2019-12-31 07:18:32
问题 My goal is to strip the images and iframes out of WordPress posts (they are in .para divs) and move them to a <ul> above the post, just inside the local wrapper (.wrapper940). The jQuery below works, but moves ALL image and iframes from all posts to a single new <ul> above the first post. Instead of this, I am trying to move the images and iframes PER POST to a new <ul> just inside the wrapper of each post. Here's the jQuery: jQuery("document").ready (function($){ var matchesEl = $(".para img

JQuery hide ULs and only expand once particular class set (bit like an accordion)

这一生的挚爱 提交于 2019-12-31 06:35:31
问题 Right folks, After battling with a JQuery Accordion trying to do what I want I think hiding all secondary UL's and only expanding them once a class my CMS sets automatically on lis would be the easiest thing. I want to have accordion type functionality, but it must expand/slide down when that particular ul is active. I have realized that a typical JQuery accordion will not suit, as I will not have toggle li's present in the CMS menu output. Menu code here: <ul id="amenu"> <li><a href=

how to get content of all <li> tags in one page using jquery

瘦欲@ 提交于 2019-12-31 04:11:12
问题 I have an html list something like this: <li id="tag">red</li> <li id="tag">yellow</li> <li id="tag">blue</li> How can I get the content of these li tags using jQuery? For example; $tags = red, yellow, blue 回答1: You can use jQuery.map() Live Demo texts = $('li').map(function(){ return $(this).text(); }).get().join(','); 回答2: var $tags = $("li").map(function(){ return $(this).text(); }).get().join(","); Here, have a fiddle: http://jsfiddle.net/KTted/2/ 回答3: First, you should change your id=

CSS problem - an element only works if its has no parent (using jquery)

只愿长相守 提交于 2019-12-31 03:22:07
问题 i have this code: CSS: .taglist { float:left; margin-left:30px; } .taglist ul { overflow:auto; list-style-type:none; border:1px solid #999; background:#ccc; padding:20px; min-height:150px; max-height:150px; width:100px; } .taglist li { display:block; border:1px solid #999; background:#fff; width:80px; padding:5px 10px; margin-bottom:5px; } .tag_selected { background:#ffc; } HTML: <div class="taglist"> <ul id="list1"> <li id="1">1</li> </ul> </div> Now I'm using jQuery for this one.. so when

jQuery append() not adding </ul><ul> [duplicate]

谁说胖子不能爱 提交于 2019-12-30 23:02:22
问题 This question already has answers here : Closed 6 years ago . Possible Duplicate: Using .after() to add html closing and open tags I want to show 3 columns lists ( <ul> ) with almost the same height, so I'm counting the <li> tags and use append to generate the list dynamically. But when I do $el.append($("</ul><ul class='new'>")) to close the current list and append a new one it appends like <ul class='new'></ul> . I just want to close the <ul> tag and open it again. Is jQuery append()

Aligning <li> next to each other, not working

偶尔善良 提交于 2019-12-30 09:39:11
问题 I have a problem with aligment of two li elements inside a div because in the next example HTML <div id="menu-container"> <div class="menu-left"> <ul id="menu-principal" class="menu"> <li><a href="">Hola</a></li> <li><a href="">Hola2</a></li> </ul> </div> <!-- More code --> </div> The CSS code is in the next link and I use that html structure because that is what is generated by placing a menu in wordpress. http://jsfiddle.net/Soldier/KhLhR/1/ I have a simple code with two li elements and I

Nested Orderd List with combination of numbers, alphatets and roman numerals for numbering?

假如想象 提交于 2019-12-30 08:33:25
问题 I want to create an ordered list that looks like this: 1. Item_1 2. Item_2: a. Subitem_1 b. Subitem_2: I. Sub-Subitem_1 II. Sub-Subitem_2 c. Subtiem_3 3. Item 3 i.e. sub-lists should use alphabets/Roman Numbers or other such notations for numbering. I tried nesting <ol> tags but that plainly numbered the sub-lists. Is there a way of doing this using only HTML ? 回答1: <ol type="1|a|A|i|I"> 1 Default. Decimal numbers (1, 2, 3, 4) a Alphabetically ordered list, lowercase (a, b, c, d) A