Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. Get selected Li from UL

Get selected Li from UL

Scheduled Pinned Locked Moved JavaScript
helpannouncement
3 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    indian143
    wrote on last edited by
    #1

    Hi All, I have an Unordered List which has many list items, and when we select a li, it opens up two spans, in one of the Span we have have radio buttons, I want to get the baseURL field that is attached to the li that I am selecting so that, can any one please help me any code snippet, link or even suggestion would be helpful. Thanks in advance. All I want is either to get the report-url attribute or value of the span under the li that is selected or we can say active, I tried in the following ways but couldn't succeed, by the way I have to get these values when I click on the radio button that is within this list item, please help me.

            var listitm = $("#li.report active");            
            var ttl = listitm.find('span.title').toString();
            alert(ttl);
    
    • Enrollment by Child
      
        Lists children with their age, poverty level, IEP status, priority points and first and last days attending class.   
      

      This report includes children who have started class and children with an expected start date in the future. The "As of" date version of this report includes children with a pending exit or with an exit on the "As Of" date. The "Cumulative" version of this report includes all children who exited during the reporting period. Children who never attend class are subtracted from this report upon exit or transfer.

      x

      Report Parameters for Enrollment by Child Report

            <label for="phb\_ddlSchoolYear" id="phb\_lblSchoolYear" class="req">School Year</label>
          
      
          
      
            <input type="submit" name="ctl00$phb$btnRunReport1" value="Run Report" id="phb\_btnRunReport1" style="width: 115px; background-image: url(http:
      
    M S 2 Replies Last reply
    0
    • I indian143

      Hi All, I have an Unordered List which has many list items, and when we select a li, it opens up two spans, in one of the Span we have have radio buttons, I want to get the baseURL field that is attached to the li that I am selecting so that, can any one please help me any code snippet, link or even suggestion would be helpful. Thanks in advance. All I want is either to get the report-url attribute or value of the span under the li that is selected or we can say active, I tried in the following ways but couldn't succeed, by the way I have to get these values when I click on the radio button that is within this list item, please help me.

              var listitm = $("#li.report active");            
              var ttl = listitm.find('span.title').toString();
              alert(ttl);
      
      • Enrollment by Child
        
          Lists children with their age, poverty level, IEP status, priority points and first and last days attending class.   
        

        This report includes children who have started class and children with an expected start date in the future. The "As of" date version of this report includes children with a pending exit or with an exit on the "As Of" date. The "Cumulative" version of this report includes all children who exited during the reporting period. Children who never attend class are subtracted from this report upon exit or transfer.

        x

        Report Parameters for Enrollment by Child Report

              <label for="phb\_ddlSchoolYear" id="phb\_lblSchoolYear" class="req">School Year</label>
            
        
            
        
              <input type="submit" name="ctl00$phb$btnRunReport1" value="Run Report" id="phb\_btnRunReport1" style="width: 115px; background-image: url(http:
        
      M Offline
      M Offline
      Matt U
      wrote on last edited by
      #2

      This line:

      var listitm = $("#li.report active");

      You're referencing "active" as if it's a tag. Add the "." before it, like so: "#li.report.active". You can chain the tag + classes. Also, to read an attribute, you use jQuery's "attr()" method:

      var title = listitm.find("span.title").text(); // This is the text inside the SPAN tag
      var url = listitm.find("span.title").attr("report-url"); // Reads the attribute "report-url"

      djj55: Nice but may have a permission problem Pete O'Hanlon: He has my permission to run it.

      1 Reply Last reply
      0
      • I indian143

        Hi All, I have an Unordered List which has many list items, and when we select a li, it opens up two spans, in one of the Span we have have radio buttons, I want to get the baseURL field that is attached to the li that I am selecting so that, can any one please help me any code snippet, link or even suggestion would be helpful. Thanks in advance. All I want is either to get the report-url attribute or value of the span under the li that is selected or we can say active, I tried in the following ways but couldn't succeed, by the way I have to get these values when I click on the radio button that is within this list item, please help me.

                var listitm = $("#li.report active");            
                var ttl = listitm.find('span.title').toString();
                alert(ttl);
        
        • Enrollment by Child
          
            Lists children with their age, poverty level, IEP status, priority points and first and last days attending class.   
          

          This report includes children who have started class and children with an expected start date in the future. The "As of" date version of this report includes children with a pending exit or with an exit on the "As Of" date. The "Cumulative" version of this report includes all children who exited during the reporting period. Children who never attend class are subtracted from this report upon exit or transfer.

          x

          Report Parameters for Enrollment by Child Report

                <label for="phb\_ddlSchoolYear" id="phb\_lblSchoolYear" class="req">School Year</label>
              
          
              
          
                <input type="submit" name="ctl00$phb$btnRunReport1" value="Run Report" id="phb\_btnRunReport1" style="width: 115px; background-image: url(http:
          
        S Offline
        S Offline
        Simewu
        wrote on last edited by
        #3
        • In Javascript document.activeElement will get the currently selected element.
        • Or in the HTML you could add onclick="myFunction(this)".
        • Or onchange="myFunction(this)" to the tag.
        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups