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 1053571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:16:25+00:00 2026-05-16T17:16:25+00:00

var div = $(this), ul = $(ul, div), li = $(li, ul); Please explain,

  • 0
var div = $(this), ul = $("ul", div), li = $("li", ul);

Please explain, what does this code do?

By steps.

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-16T17:16:25+00:00Added an answer on May 16, 2026 at 5:16 pm

    It ends up with these equivalents:

    var div = $(this);
    var ul = $(this).find("ul");
    var li = $(this).find("ul").find("li");
    

    So it’s getting the current <div>, any <ul> elements inside it, and any <li> elements inside those, and placing each collection in its own variable.

    When you do $(selector, content) you’re actually doing $(context).find(selector) under the covers, so the code in your question is just chaining one call to the next, effectively doing a .find() inside each time.

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

Sidebar

Related Questions

Here is some code: var class = function(elem,div){ this.elem= elem; this.div = div; this.init
I have made this code: var foo=document.createElement(div); var childs=foo.getElementsByTagName(*); console.log(childs.length);//0 OK var a=document.createElement(a); foo.appendChild(a);
This is a simplified and explained version of my code: var ptext=parr.find('div.ptext'); //Text Container
jsfiddle is here: http://jsfiddle.net/M86nA/ code is this: $('div.wrap').click(function(){ var $minY = $('div.imgur-wrap').height(); if ($minY
Using this code var html='<div class=somediv></div>'; var target=document.getElementById('contentArea'); target.appendChild(html); I'm getting Uncaught Error: NOT_FOUND_ERR:
I have this code: <div id=gll_select> <script> var caffe = $(#caffe).val(); $(#gll_select).load(<?php echo base_url()
If I run this code - var html= '<html><head></head><body><div class=bar></div></body></html>'; console.log($(html).find('div')); I get no
i've got this $('#div').attr(hidden, true); i tried: var a = $('#div').attr(hidden); var b =
$(a.close).click(function() { var id = $(this).attr(id); alert(id); $(this).parents(div.venue:first).fadeOut(Fast); return false; }); Any ideas why
I made this Greasemonkey script: var maxpi = 250; var p1 = /html/body/div/div[2]/div/div[2]/table[2]/tbody/tr[1]/td[11]; var

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.