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

  • Home
  • SEARCH
  • 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 3619340
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:51:58+00:00 2026-05-18T22:51:58+00:00

<html> <head> <script type=text/javascript src=jquery.js></script> </head> <body> <ul> <li><strong>list</strong> item 1 – one strong

  • 0
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
</head>
<body>
<ul>
  <li><strong>list</strong> item 1 -
    one strong tag</li>
  <li><strong>list</strong> item <strong>2</strong> -
    two <span>strong tags</span></li>
  <li>list item 3</li>
  <li>list item 4</li>
  <li>list item 5</li>
  <li>list item 6</li>
</ul>

<script type="text/javascript">
$('li').filter(function(index) {
  return $('strong', this).length == 1;
}).css('background-color','red');
</script>

</body>
</html>

Given the HTML above, what’s the meaning of the comma in the selector below?

return $('strong', this).length == 2;

What will happen if I remove the word ‘strong’?

  • 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-18T22:51:59+00:00Added an answer on May 18, 2026 at 10:51 pm

    It sets this as the context from which the query is performed.

    An equivalent (and slightly more efficient) way to write it is:

    return $(this).find('strong').length == 2;
    

    When I say equivalent, I mean behind the scenes, it is actually flipped around into the version above.

    If you remove the 'strong', you won’t have a valid selector. You’ll be doing:

    return $(this).find('').length == 2;
    

    Looks like it just returns an empty jQuery object, which means length will be 0, so you won’t get any elements out of the .filter().


    Reference:

    http://api.jquery.com/jQuery/

    jQuery( selector [, context ] )

    context

    Type: Element or jQuery

    A DOM Element, Document, or jQuery to use as context

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

Sidebar

Related Questions

I have the following file file: <html> <head> <title></title> <script type=text/javascript src=/Prototype.js></script> <script type=text/javascript>
I am using this HTML <html> <head> <Title>EBAY Search</title> </head> <script language=JavaScript src=ajaxlib.js></script> <body>
I have the following code <html> <head> <title>Test</title> <style type=text/css> <!-- body,td,th { color:
For example: script.js: function functionFromScriptJS() { alert('inside functionFromScriptJS'); } iframe.html: <html> <head> <script language=Javascript
Code: <html xmlns=http://www.w3.org/1999/xhtml> <head> <title>Unusual Array Lengths!</title> <script type=text/javascript> var arrayList = new Array();
I am using the following html page: <html> <head> <title>AJAX Example</title> <meta http-equiv=Content-Type content=text/html;
Code and preview: <html> <head> <title>Testing some CSS</title> <style type=text/css> .dDay { font-size:205% }
<html> <head> <style type=text/css> div { border:1px solid #000; min-width: 50%; } </style> </head>
I'm attempting to select all <script type=text/html> tags in a page. I use <script>
In a html page we use the head tag to add reference to our

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.