Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6654841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:26:19+00:00 2026-05-26T01:26:19+00:00

Code: http://jsfiddle.net/JhcYu/ <!DOCTYPE HTML> <html lang=en-US> <head> <meta charset=UTF-8> <title></title> <link type=text/css href=css/smoothness/jquery-ui-1.8.16.custom.css rel=stylesheet

  • 0

Code: http://jsfiddle.net/JhcYu/

<!DOCTYPE HTML>
<html lang="en-US">
<head>
    <meta charset="UTF-8">
    <title></title>
    <link type="text/css" href="css/smoothness/jquery-ui-1.8.16.custom.css" rel="stylesheet" />    
    <script type="text/javascript" src="script/jquery-1.6.2.min.js"></script>
    <script type="text/javascript" src="script/jquery-ui-1.8.16.custom.min.js"></script>
    <script type="text/javascript">

         $(function() {

            $("#tabs, #tabs2").tabs();

            $('#tabs').tabs('select', 0);

            $('#alt2 li').click(function(e) {

                if($(this).find('>ul').is(':visible'))
                     $(this).find('>span').html('+');
                else
                     $(this).find('>span').html('-');        


                $(this).find('>ul').stop(true, true).slideToggle(150, "swing")
            /*    .end().siblings().find('ul').slideUp().closest('li')    */
                .find('>span').html('+');


                $('#alt2 li').each(function(){
                    $(this).css({ 'font-weight' : 'normal'  });
                });

                $(this).css({ 'font-weight' : 'bold' }).children().css({ 'font-weight' : 'normal' });

                e.stopPropagation();
            });

            $('#alt2 li').each(function(i, val){

                var children = $(val).find('ul li');

                if(children.size() > 0)
                    $(val).prepend('<span>+</span>');


            });

            function selectListitemByText(listitemText) {

                $('#alt2 li').each(function(i, val){

                    var currentListitemText = $(this).clone().children().remove().end().text().trim();

                    if(currentListitemText == listitemText) {

                        //$(val)...
                        return false;
                    }
                });
            }





        });

    </script>

    <style type="text/css">


        body { font: 12px Verdana; }

        .ui-tabs-nav { background: transparent; border-width: 0px 0px 1px 0px;  }
        .ui-tabs .ui-tabs-nav { padding: 0.2em 0 0; }
        .ui-widget-content { border: 0; }
        .ui-tabs .ui-tabs-panel { border: 1px solid #aaa; border-width: 1px; border-top: 0;}
        .ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { border-radius: 0; }

        #tabs-2 { padding: 0; }

        #alt2 { width: 500px; margin: 0 auto; }
        #alt2 ul { list-style: none; }
        #alt2 ul ul { display: none; }
        #alt2 li { cursor: pointer; margin: 5px; }

    </style>
</head>
<body>


<div id="alt2">

    <ul>
        <li>
            System Audit
            <ul>
                <li >Site and Contacts</li>
                <li>Current Licenses</li>
            </ul>
        </li>
        <li>
            Expected Result
            <ul>
                <li>
                    Control System Information
                    <ul>
                        <li>ABB Contacts</li>
                        <li>Channel Partner Contact</li>
                    </ul>
                </li>

                <li>Machine ID's</li>
                <li>Current Licenses</li>
            </ul>
        </li>
        <li>
            Quotation
            <ul>
                <li>Lorem</li>
                <li>Ipsum</li>
                <li>Result</li>
            </ul>
        </li>
    </ul>
</div>

</body>
</html>

I want a function, “selectListitemByText”, that selects a listitem at any depth. The functionality should remain the same (+ turns in to – when expended, font+weight: bold etc). Ive started writing the function but im not really sure how to select the correct parents and children.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:26:20+00:00Added an answer on May 26, 2026 at 1:26 am

    I have written a function which works pretty well, but I had to had some stuff to your code.

    See the comments in this fiddle :

    http://jsfiddle.net/59tKg/5/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Code: http://jsfiddle.net/tRRtY/ <!DOCTYPE HTML> <html> <head> <title>$$ float</title> <script type=text/javascript src=http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=default> </script> <style type=text/css>
I have this code: http://jsfiddle.net/cmF4S/3/ <div style=float: left; position: relative;> <input type=text placeholder=Search... style=float:
I have the following code: http://jsfiddle.net/cosoroaba/nCEwv/ HTML: <div id=square> <div class=corner-wrapper> <div id=ctr></div> </div>
I have the following code: http://jsfiddle.net/YfzbZ/ HTML <dl class=dropdown right> <dt><a>Options</a></dt> <dd> <ul style=display:none;>
Code: http://jsfiddle.net/n3mcH/ I use http://www.cssstickyfooter.com/using-sticky-footer-code.html . The footer is attached to the bottom, but
So take a look at the code: http://jsfiddle.net/qb34B/ Type an invalid email, hit the
I have this code: http://jsfiddle.net/bUPWS/1/ but #div2 overflows #div1. How to bring the overflowed
This is my code http://jsfiddle.net/Cfa6c/8/ Basically what I need to do is get the
I have the following code: http://jsfiddle.net/fCWJ5/1/ , and following doubts regarding the viewbox. body{margin:0;}
jsFiddle Full Code: http://jsfiddle.net/bvmdW/ I used jQuery Embedly to replace YouTube links with thumbnail

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.