Search Results

Search found 2947 results on 118 pages for 'bojin li'.

Page 28/118 | < Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >

  • How to get rid of white space between css horizontal list items?

    - by Curyous
    I've got the following test page and css. When displayed, there is a 4px gap between each list item. How do I get the items to be next to each other? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> <html> <head> <link type="text/css" rel="stylesheet" href="/stylesheets/test.css" /> </head> <body> <div> <ul class="nav"> <li class="nav"><a class="nav" href="#">One1</a></li> <li class="nav"><a class="nav" href="#">Two</a></li> <li class="nav"><a class="nav" href="#">Three</a></li> <li class="nav"><a class="nav" href="#">Four</a></li> </ul> </div> </body> </html> The css: ul.nav, ul li.nav { display: inline; margin: 0px; padding: 0px; } ul.nav { list-style-type: none; } li.nav { background-color: red; } a.nav { background-color: green; padding: 10px; margin: 0px; } a:hover.nav { background-color: gray; }

    Read the article

  • What's the best way to format long strings of HTML in PHP?

    - by dclowd9901
    I know it's really a subjective question, but for best-practices (and readability), I can't seem to get a fix on the best way to format long strings of HTML. I typically do it like this: echo ' <div> <p>Content Inside</p> <div class="subbox"> <ul> <li>etc.</li> <li>etc.</li> <li>etc.</li> <li>etc.</li> </ul> </div> </div> '; But I still don't like the outcome, especially if this appears in the middle of a large block of code. It just feels messy.

    Read the article

  • Looping through an List to select an Element in Selenium

    - by ChrisMcLellan
    I'm attempting to write a Page Class for Links within the Header of the website I'm testing. I have the following link structure below <ul> <li><a href="/" title="Home">Home</a></li> <li><a href="/AboutUs" title="About Us">About Us</a> </li> <li><a href="/Account" title="Account">Account</a></li> <li><a href="/Account/Orders" title="Orders">Orders</a></li> <li><a href="/AdministrationPortal" title="Administration Portal">Administration Portal</a></li> </ul> What I want to do is store these into a List, then when a user select one of the links, it will take then to the page they should go to. I have started with the following code below List<IWebElement> headerElements = new List<IWebElement>(); headerElements.Add(WebDriver.FindElement(By.LinkText("Home"))); headerElements.Add(WebDriver.FindElement(By.LinkText("About Us"))); headerElements.Add(WebDriver.FindElement(By.LinkText("Account"))); headerElements.Add(WebDriver.FindElement(By.LinkText("Orders"))); headerElements.Add(WebDriver.FindElement(By.LinkText("Administration Portal"))); headerElements.Add(WebDriver.FindElement(By.LinkText("Log in / Register"))); headerElements.Add(WebDriver.FindElement(By.LinkText("Log off"))); I was thinking for using a for loop to do this, would this be the best way. I'm trying to avoid writting methods like the one below for each link public void SelectCreateNewReferralLink() { var selectAboutUsLink = ( new WebDriverWait(WebDriver, new TimeSpan(50))).Until (ExpectedConditions.ElementExists(By.CssSelector("#main > a:nth-of-type(1)"))); selectCreateNewReferralLink.Click(); } I'm using C#, with WebDriver attempting to write this Any Help would be great Thanks Chris

    Read the article

  • How to change the css class="current" when using page jumping (single page website)?

    - by Bryan
    Morning, I must be asking google all the wrong questions, because I can't find anything similar. I have a standard navigation list, but I'm using page jumping because I wanted a single web page. <ul> <li><a href="#livestream">Livestream</a></li> <li><a href="#media">Media</a></li> <li><a href="#crew">Crew</a></li> <li><a href="#services">Services</a></li> <li><a href="#contact">Contact</a></li> </ul> But I can't for the life of me figure out how to make the class="current" when using page jumping. I've tried this bit of jquery because it appears to be what I'm looking for, but it did nothing. I don't think it'll work for #links. Any ideas?

    Read the article

  • When a li is appended, does it not become a part of the ul "for real"?

    - by Noor
    I have right now this code: <ul><li class="listitem">text<li></ul> jQuery: $('.listitem').click(function() { $("#elname").text($(this).text()); $('#slists').css('visibility','hidden') $('#elname').css('visibility','visible') $('#elname').css('display','inline-block') }); This is supposed to hide a div and it does, but when I append items to the ul (with the class listitem) nothing happens with the appended item, the class it gets is correct, the title, and the value too. Can this have something to do with the code above being in the document ready function to do?

    Read the article

  • How to take a Serialized String from the DB and output a UL list with Coldfusion

    - by nobosh
    Given a string from the database as follows: ul[0][id]=main1&ul[0][children][0][id]=child2&ul[0][children][0][class]=&ul[1][id]=main3&ul[2][id]=main4&ul[3][id]=main5 Where what's after the equal sign is an ID, how can I take this string on the backend and build out a list as following from front-end output? <UL id="container"> <LI id="main1"> Lorem ipsum dolor sit amet, consectetur <UL> <LI id="child2"> In hac habitasse platea dictumst. <UL></UL> </LI> </UL> </LI> <LI id="main3"> In hac habitasse platea dictumst. <UL></UL> </LI> <LI id="main4"> In hac habitasse platea dictumst. <UL></UL> </LI> <LI id="main5"> In hac habitasse platea dictumst. <UL></UL> </LI> </UL> Thanks

    Read the article

  • Change the output of the Html.menu() asp control .

    - by user327893
    Im creating a asp mvc application and im using a sitemap to create my menu. Is it possible to change the output of the Html.menu() asp control? normal output: <ul> <li><a href="#">Item 1</li> <li><a href="#">Item 2</li> </ul> needed output: <ul> <li><a href="#"><span>Item 1</span></li> <li><a href="#"><span>Item 2</span></li> </ul> Or should i filter true the nodes of the sitemap to get the format i want?? TY in advance:)

    Read the article

  • Given the Following List (UL), how can it be serialized and sent to the Database

    - by nobosh
    I have the follow structure which is created with a nested sortable: <UL id="container"> <LI id="main1"> <input type="checkbox" /> Lorem ipsum dolor sit amet, consectetur <UL> <LI id="child2"> <input type="checkbox" /> In hac habitasse platea dictumst. <UL></UL> </LI> </UL> </LI> <LI id="main3"> <input type="checkbox" /> In hac habitasse platea dictumst. <UL></UL> </LI> <LI id="main4"> <input type="checkbox" /> In hac habitasse platea dictumst. <UL></UL> </LI> <LI id="main5"> <input type="checkbox" /> In hac habitasse platea dictumst. <UL></UL> </LI> </UL> Where I'm stuck is how to send this back to the database. I"m guessing that it needs to be serialized, does that sound right to? so that is looks something like: item[]=main1&item[]=221&item_221[]=21&item_221[]=2&item_221[]=211&item[]=22 I'm a little lost at this point and appreciate any tips to move me in the right direction. Thanks, B

    Read the article

  • jQuery Dropdown

    - by Phil
    I've been able to make a jQuery drop down, however, I can't make it stay expanded when one of the child links is rolled over. Code: <li> <a onmouseover="$('.dropdown-1').slideDown('medium');" href="/hosting">Why Veoloo</a> <ul class="dropdown-1"> <li onmouseout="$('.dropdown-1').slideUp('medium');"><a href="#">The Reasons (15)</a></li> <li onmouseout="$('.dropdown-1').slideUp('medium');"><a href="#">Customer Testimonials</a></li> <li onmouseout="$('.dropdown-1').slideUp('medium');"><a href="#">Our Support Scope</a></li> </ul> </li>

    Read the article

  • jQuery works in FF but not in Safari

    - by Hristo
    I have some event handlers that work in FF and not in Safari. Simply put, I have a list of friends, some hard-coded, some pulled in from a database. Clicking on a buddy opens a chat window... this is much like the Facebook chat system. So in Firefox, everything works normally and as expected. In Safari, clicking on buddies that are hard-coded works fine, but clicking on buddies that are pulled in from the database doesn't pull up the chat window. <script type="text/javascript" src="js/jQuery.js"></script> <script type="text/javascript" src="js/chat.js"></script> <script type="text/javascript" src="js/ChatBar.js"></script> <script type="text/javascript" src="js/settings.js"></script> <script type="text/javascript"> var chat = new Chat(); var from = <?php echo "'" .$_SESSION['userid'] . "'"; ?>; chat.getUsers(<?php echo "'" .$_SESSION['userid'] . "'"; ?>); </script> So I load all my buddies with chat.getUsers. That function is: // get list of friends function getBuddyList(userName) { userNameID = userName; $.ajax({ type: "GET", url: "buddyList.php", data: { 'userName': userName, 'current': numOfUsers }, dataType: "json", cache: false, success: function(data) { if (numOfUsers != data.numOfUsers) { numOfUsers = data.numOfUsers; var list = "<li><span>Agents</span></li>"; for (var i = 0; i < data.friendlist.length; i++) { list += "<li><a class=\"buddy\" href=\"#\"><img alt=\"\" src=\"images/chat-thumb.gif\">"+ data.friendlist[i] +"</a></li>"; } $('#friend-list ul').append($(list)); } setTimeout('getBuddyList(userNameID)', 1000); } }); } buddyList.php just pulls in the Users from the database and returns an array with the user names. So the jQuery for clicking a buddy is: // click on buddy in #friends-panel $('#friends-panel a.buddy').click(function() { alert("Loaded"); // close #friends-panel $('.subpanel').hide(); $('#friends-panel a.chat').removeClass('active'); // if a chat window is already active, close it and deactivate $('#mainpanel li[class="active-buddy-tab"] div').not('#chat-box').removeAttr('id'); $('#mainpanel li[class="active-buddy-tab"]').removeClass('active-buddy-tab').addClass('buddy-tab'); // create active buddy chat window $('#mainpanel').append('<li class="active-buddy-tab"><a class="buddy-tab" href="#"></a><div id="chat-window"><h3><p id="to"></p></h3></div></li>'); // create name and close/minimize buttons $('.active-buddy-tab div h3 p#to').text($(this).text()); $('.active-buddy-tab div h3').append('<span class="close"> X </span><span class="minimize"> &ndash; </span>'); $('.active-buddy-tab').append('<span class="close"> X </span>'); // create chat area $('.active-buddy-tab div').append('<div id="chat-box"></div><form id="chat-message"><textarea id="message" maxlength="100"></textarea></form>'); // put curser in chat window $('.active-buddy-tab #message').focus(); // create a chat relationship return false; }); ... and the basic structure of the HTML is: <div id="footpanel"> <ul id="mainpanel"> <li id="friends-panel"> <a href="#" class="chat">Friends (<strong>18</strong>) </a> <div id="friend-list" class="subpanel"> <h3><span> &ndash; </span>Friends Online</h3> <ul> <li><span>Family Members</span></li> <!-- Hard coded buddies --> <li><a href="#" class="buddy"><img src="images/chat-thumb.gif" alt="" /> Your Friend 1</a></li> <li><a href="#" class="buddy"><img src="images/chat-thumb.gif" alt="" /> Your Friend </a></li> <!-- buddies will be added in dynamically here --> </ul> </div> </li> </ul> </div> I'm not too sure where to begin solving this issue. I thought it might be a rendering bug or something with the DOM but I've been staring at this code all day and I'm stuck. Any ideas on why it works in FF and not in Safari? btw... I'm testing on Snow Leopard. Thanks, Hristo

    Read the article

  • jquery selector

    - by Sotos
    hello, i have the below sample code for a navigation list: <div id="menu"> <ul> <li><a href="#sect1">link 1</a></li> <li><a href="#sect2">link 2</a></li> <li><a href="#sect3">link 3</a></li> </ul> </div> and some jquery code: $("#menu li").click(function () { var mylicontent=$(this).html(); }); i want to get both html content of the li object and the href value. Any ideas?

    Read the article

  • Add class active when clicking the menu link with Jquery

    - by Adrian
    I have HTML <div id="top" class="shadow"> <ul class="gprc"> <li><a href="http://www.domain.com/">Home</a></li> <li><a href="http://www.domain.com/link1/">Text1</a></li> <li><a href="http://www.domain.com/link2/">Text2</a></li> <li><a href="http://www.domain.com/link3/">Text3</a></li> <li><a href="http://www.domain.com/link4">Text4</a></li> </ul> </div> and JQUERY $(function () { var url = window.location.pathname, urlRegExp = new RegExp(url.replace(/\/$/, '') + "$"); $('#top a').each(function () { if (urlRegExp.test(this.href.replace(/\/$/, ''))) { $(this).addClass('active'); } }); }); The problem is that when i click on the Home link all tabs are getting active class and don't understand why. I need it for the first link to not get any active class.

    Read the article

  • jquery :not selector not working in next() method

    - by Richard
    what is the next best thing to use when you want to select the next li item, but not the one that has someClassName. The not selector returns an empty array! or is this a case off using filter? <li class="first">pickle</> <li class="someClassName">tomato</li> <li>chicken</> <li>cocosnut</> var current = $('ul.items li.first'); var next = current.next(':not(li.someClassName)'); thanks, Richard

    Read the article

  • Saving JQuery Draggable Sitemap Values Correctly

    - by mdolon
    I am trying to implement Boagworld's Sitemap tutorial, however I am running into difficulty trying to correctly save the child/parent relationships. The HTML is as follows, however populated with other items as well: <input type="hidden" name="sitemap-order" id="sitemap-order" value="" /> <ul id=”sitemap”> <li id="1"> <dl> <dt><a href=”#”>expand/collapse</a> <a href=”#”>Page Title</a></dt> <dd>Text Page</dd> <dd>Published</dd> <dd><a href=”#”>delete</a></dd> </dl> <ul><!–child pages–></ul> </li> </ul> And here is the JQuery code: $('#sitemap li').prepend('<div class="dropzone"></div>'); $('#sitemap li').draggable({ handle: ' > dl', opacity: .8, addClasses: false, helper: 'clone', zIndex: 100 }); var order = ""; $('#sitemap dl, #sitemap .dropzone').droppable({ accept: '#sitemap li', tolerance: 'pointer', drop: function(e, ui) { var li = $(this).parent(); var child = !$(this).hasClass('dropzone'); //If this is our first child, we'll need a ul to drop into. if (child && li.children('ul').length == 0) { li.append('<ul/>'); } //ui.draggable is our reference to the item that's been dragged. if (child) { li.children('ul').append(ui.draggable); }else { li.before(ui.draggable); } //reset our background colours. li.find('dl,.dropzone').css({ backgroundColor: '', backgroundColor: '' }); li.find('.dropzone').css({ height: '8px', margin: '0' }); // THE PROBLEM: var parentid = $(this).parent().attr('id'); menuorder += ui.draggable.attr('id')+'=>'+parentid+','; $("#sitemap-order").val(order); }, over: function() { $(this).filter('dl').css({ backgroundColor: '#ccc' }); $(this).filter('.dropzone').css({ backgroundColor: '#aaa', height: '30px', margin: '5px 0'}); }, out: function() { $(this).filter('dl').css({ backgroundColor: '' }); $(this).filter('.dropzone').css({ backgroundColor: '', height: '8px', margin: '0' }); } }); When moving items into the top-level (without parents), the parentid value I get is of the first list item (the parent container), so I can never remove the parent value and have a top-level item. Is there a no-brainer answer that I'm just not seeing right now? Any help is appreciated.

    Read the article

  • Filtering content (jQuery)

    - by Nimbuz
    HTML: <div class="filter"> <a href="#category-1">category 1</a> <a href="#category-2">category 2</a> </div> <ul class="items"> <li class="category-1">item 1</li> <li class="category-1">item 2</li> <li class="category-2">item 3</li> <li class="category-2">item 4</li> </ul> What I want is for example clicking on 'category 1' link should hide all other category items from the list. I understand jQuery's .filter() selector can be used but I'm not sure how to implement it for my purpose here. Thanks for your help!

    Read the article

  • Simple html page using Bootstrap

    - by Athashri
    I am writing a simple HTML page using the Twitter Bootstrap. But the navbar and links are rendered as normal HTML on the browser. I have referred to multiple sites but the same steps are given everywhere. I am not sure where I am going wrong. Code: <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <link rel= "stylesheet" href= "css/bootstrap.css" type="text/css"> <title> Bootstrap example</title> </head> <body> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script src="js/bootstrap.js"></script> <h1>Hello, world!</h1> <div class ="container"> <h1><a href="#">Bootstrap Site</a></h1> <div class="navbar"> <div class="navbar-inner"> <div class="container"> <ul class="nav"> <li class="active"><a href="#">Home</a></li> <li><a href="#">Projects</a></li> <li><a href="#">Services</a></li> <li><a href="#">Downloads</a></li> <li><a href="#">About</a></li> <li><a href="#">Contact</a></li> </ul> </div> </div> </div> </div> </body> </html>

    Read the article

  • jQuery toggle caching / cookies

    - by user1706680
    I’m using the jQuery toggle function for my navigation. By default the Authors toggle is visible, the Archives toggle is closed. http://jsfiddle.net/TeDFs/4/ My problem is that when the users switches to another page the toggles reset themselves. For example, when the user closes the Authors toggle and opens the Archive toggle and then navigates to another page the default settings are loaded. I read that it’s possible to store the settings via cookies but I’m absolutely new to jQuery and it would be great if somebody could help me out! HTML <div id="authors" class="widget"> <h2 class="widget-title-visible">Authors</h2> <div class="toggle"> <div class="submenu"> <ul> <li>Name 1</li> <li>Name 2</li> <li>Name 3</li> <li>Name 3</li> </ul> </div> </div> <div id="archives" class="widget"> <h2 class="widget-title">Archiv</h2> <div class="toggle hidden"> <div class="submenu"> <ul> <li>November 2012</li> <li>Oktober 2012</li> </ul> </div> </div> </div>? jQuery function toggleWidgets() { jQuery('.widget-title').addClass('plus'); jQuery('.widget-title-visible').addClass('minus'); jQuery('.widget-title').click(function() { $(this).toggleClass('plus').toggleClass('minus').next().toggle(180); }); jQuery('.widget-title-visible').click(function() { $(this).toggleClass('minus').toggleClass('plus').next().toggle(180); }); } jQuery(document).ready(function() { toggleWidgets(); } )? CSS .hidden{ display:none; } .plus { background: url(http://moargh.de/daten/sidebar_arrows.png) 0 5px no-repeat; padding: 0 0 0 12px; } .minus { background: url(http://moargh.de/daten/sidebar_arrows.png) 0 -10px no-repeat; padding: 0 0 0 12px; }

    Read the article

  • CSS highlight menu item based on page body tags

    - by Sai
    I have a menu, I would like to highlight the sub menu item based on the page they are in. Can I use a div tag with an id on the page, and in css if the id is there then highlight the item. in body <div id="doc3"></div> then in css #doc3 #menu li#subnav-5-1 a I tried this but dosent seem to work. How can I change the style of another element based on id in the page body? menu... <!-- Menu 5 --> <li id="nav-5"><a href="ssslate.do">Micro</a> <ul id="subnav-5"> <li class="subnav-5-1"><a href="asdf.do">Site & Visit</a></li> <li><a href="ss.do">MIC</a></li> <li><a href="ss.do">sss</a></li> </ul> </li> CSS body.nav-5-1 li.subnav-5-1 {background-color:red;} htmlbody <body id=nav-5-body class="nav-5-1"> Thanks

    Read the article

  • Tab on hover mode while mouse over drop down menu

    - by Hwang
    How could I have the tab to be on hover mode while I rollover the drop down sub-menu. Does it require javascript or it could be done solely on CSS? <li id="anchor" class="title dropdown"><a href="#">Main Tab</a> <div class="column"> <ul> <li class="subtitle">Button 1</li> <li class="subtitle">Button 2</li> <li class="subtitle">Button 3</li> </div> </li>

    Read the article

  • Flexslider links not opening

    - by Marina Nelson
    I am trying to get the slides to link to other pages on the site. The pointer shows when I click on the slides, but page does not open: <div class="flexslider"> <ul class="slides"> <li> <a href="page1.html"><img src="img/slide-1.jpg" alt="" ></a> </li> <li> <a href="page2.html"><img src="img/slide-2.jpg" alt="" ></a> </li> <li> <a href="page3.html"><img src="img/slide-3.jpg" alt="" ></a> </li> <li> <a href="page4.html"><img src="img/slide-4.jpg" alt="" ></a> </li> <li> <a href="page5.html"><img src="img/slide-5.jpg" alt="" ></a> </li> </ul> </div> I have not altered any other code. Am I missing something? I don't know Jquery well. Thanks.

    Read the article

  • Hide ul when lost focus in JQuery..

    - by Ramesh Vel
    Hi, I am trying to hide the sub menu items(ul) when it lost focus.. my structure looks something like this <div id="ActionDiv" style="border-color: #0099d4; width: 120px; height: 100%"> <ul> <li><a href="#"><span id="ActionHeader">Action &nbsp; <em> <img src="images/zonebar-downarrow.png" alt="dropdown" /> </em></span></a> <ul> <li><a href="javascript:TriggerAction(1)">Send Email</a></li> <li><a href="javascript:TriggerAction(1)">Invite to chat</a></li> <li><a href="javascript:TriggerAction(1)">Consider For Opp</a></li> </ul> </li> </ul> </div> In JQuery i have used focusout event to handle the lost focus. $("#ActionDiv>ul>li>ul").focusout(function() { $("#ActionDiv>ul>li>ul").hide(); }); But the above code is not working. can anyone recommend a way to handle the lost focus event in the ul. Cheers

    Read the article

  • How to stop Django from adding extra html elements to rendered widgets.

    - by stinkypyper
    I have a Django radio button group that renders to HTML as follows: <ul> <li><label for="id_package_id_0"><input type="radio" id="id_package_id_0" value="1" name="package_id" /> Test 256</label></li> <li><label for="id_package_id_1"><input type="radio" id="id_package_id_1" value="2" name="package_id" /> Test 384</label></li> <li><label for="id_package_id_2"><input type="radio" id="id_package_id_2" value="3" name="package_id" /> Test 512</label></li> <li><label for="id_package_id_3"><input type="radio" id="id_package_id_3" value="4" name="package_id" /> Test 768</label></li> <li><label for="id_package_id_4"><input type="radio" id="id_package_id_4" value="5" name="package_id" /> Test 1024</label></li> </ul> I need it to render without being a list. I am a aware of form.as_p, form.as_table, and form.as_ul. They will not help me as they continue to add extra HTML tags. As well, I am not using the form object in it's absolute entirety, just for validation. I am doing a custom template for the form already, but wish to continue to the radio widget.

    Read the article

  • jQuery Accordion /Tabs - Call different function upon load of content

    - by Scott
    I have the following markup: <body> <div id="tabs" style="float: left"> <ul> <li><a href="ajax/question_0.html" title="Question 1"><span>Question 1</span></a></li> <li><a href="ajax/question_1.html" title="Question 2"><span>Question 2</span></a></li> <li><a href="ajax/question_2.html" title="Question 3"><span>Question 3</span></a></li> <li><a href="ajax/question_3.html" title="Question 4"><span>Question 4</span></a></li> <li><a href="ajax/question_4.html" title="Question 5"><span>Question 5</span></a></li> <li><a href="ajax/question_5.html" title="Question 6"><span>Question 6</span></a></li> </ul> <div id="dynamicContent"> </div> </div> <div class="demo-description"> <p>Click tabs to see answers to Questions</p> </div> </body> I would like to utilize an accordion or the tabs plugin from the UI. Upon completion of the load event, I'd like to call a JavaScript function, but a different function for each tab -- almost like calling onDocumentReady for a page. I have the following JavaScript: $(function() { $('#tabs').tabs().bind('tabsselect', function(event, ui) { console.log("Loading: ajax/question_" + ui.index + ".html"); return true; //Ensure that the tab gets selected }); ); That's properly loading the Ajax file and all, but whenever I attempt to do something such as evaluating a statement in the JS, it seems to be ignored. Is there any way I can do this, so that once the file is loaded my function is called -- needs to be a different function for each tab.

    Read the article

  • Use JQuery to target unwrapped text inside a div

    - by Chris
    I'm trying to find a way to wrap just the inner text of an element, I don't want to target any other inner dom elements. For example. <ul> <li class="this-one"> this is my item <ul> <li> this is a sub element </li> </ul> </li> </ul> I want to use jQuery to do this. <ul> <li class="this-one"> <div class="tree-item-text">this is my item</div> <ul> <li> <div class="tree-item-text">this is a sub element</div> </li> </ul> </li> </ul> A little background is I need to make an in-house tree structure ui element, So I'm using the UL structure to represent this. But I don't want developers to have to do any special formatting to use the widget. update: I just wanted to add the purpose of this is I want to add a click listener to be able to expand the elements under the li, However, since those elements are within the li the click listener will activate even when clicking on the children, So I want to attach it to the text instead, to do this the text needs to be targetable, which is why I want to wrap it in a div of it's own. So far I've come up with wrapping all the inner elements of the li in a div and then moving all inner dom elements back to the original parent. But this code is pretty heavy for something that might be much simpler and not require so much DOM manipulation. EDIT: Want to share the first pseudo alternative I came up with but I think it is very tasking for what I want to accomplish. var innerTextThing = $("ul.tree ul").parents("li").wrapInner("<div class='tree-node-text'>"); $(innerTextThing.find(".tree-node-text")).each(function(){ $(this).after($(this).children("ul")); }); Answered: I ended up doing the following, FYI i only have to worry about FF and IE compatibility so it's untested in other browsers. //this will wrap all li textNodes in a div so we can target them. $(that).find("li").contents() .filter(function () { return this.nodeType == 3; }).each(function () { if ( //these are for IE and FF compatibility (this.textContent != undefined && this.textContent.trim() != "") || (this.innerText != undefined && this.innerText.trim() != "") ) { $(this).wrap("<div class='tree-node-text'>"); } });

    Read the article

  • Left floated element and unordered lists (ul).

    - by superUntitled
    Hello, I am trying to indent the li elements of a ul. There is a left floated div with an image in it. The li element will indent only if I add left padding that is wider than the image itself. I you would like to look at a version irl, take a look. On this page, I have given the li a background color to demonstrate. <div class="left"> <p ><img src='image.jpg' alt='homepage.jpg' width="360" height="395" /></p> </div> <p> Est tincidunt doming iis nobis nibh. Ullamcorper eorum elit lius me delenit. </p> <hr /> <h3>Lorem</h3> <ul> <li>list element</li> <li>list element</li> <li>list element</li> </ul> The css: .left {float: left; } .left img {padding-right: 20px;} ul li { padding-left: 10px; background: blue; } thanks!

    Read the article

< Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >