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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:12:38+00:00 2026-06-18T09:12:38+00:00

<script> $(*, document.body).each(function () {//is document.body a context? var parentTag = $(this).parent().get(0).tagName; //Above statement

  • 0
   <script>
            $("*", document.body).each(function () {//is document.body a context?
                var parentTag = $(this).parent().get(0).tagName;
                //Above statement is only selecting the body tag why?

                $(this).prepend(document.createTextNode(parentTag + " > "));
            });
    </script>
  </body>
</html>       

Is there any reason for selecting only body tag in the above script?Also is document.body a context?since document.body is not quoted will it be a context?

  • 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-06-18T09:12:39+00:00Added an answer on June 18, 2026 at 9:12 am

    i hope these are the ansers you are looking for

    > Is there any reason for selecting only body tag in the above script?
    

    It doesnt select only the Bodytag, if you run this code in Chrome you will see the tags

     $("*" ,document.body).each(function (idx, elem) {
     console.log(elem);
     });
    

    Also is document.body a context?

    Yes, it is here is a line to the API LINK

    since document.body is not quoted will it be a context?

    Yes, it is here is a line to the API LINK

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

Sidebar

Related Questions

This is what I have... a= document.createElement('div'); a.innerHTML=<script>alert(1)</script>; document.body.appendChild(a); The alert(1) doesnt get executed.
I made this bookmarklet: javascript:(function(){var s=document.createElement('script');s.setAttribute('src','http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js');document.getElementsByTagName('body')[0].appendChild(s);$('#hldIntMain').hide();$('#fadeBackground').hide();return false;})() Formatted code: // Add in jQuery var
I mean I have this code: <script> $(document).ready( function() { $('html, body').animate({ scrollTop: $(.error).offset().top
I use this script: $(document).ready(function() { $page = jQuery.url.attr(file); alert(page); }); but I get
I have this jquery script: $('[id^=changesetList] tr').each(function () { var sid = $(this).attr('sid'); $(this).find('td
<script type=text/javascript> $(document).ready(function() { $(body).css(display, none); $(body).fadeIn(slow); $(a.link).click(function(event){ event.preventDefault(); linkLocation = this.href; $(body).fadeOut(slow, redirectPage);
<html> <body> <script type=text/javascript> var str=Welcome to Microsoft! ; var val=Microsoft!; document.write(str.replace('/'+val'+/gi', W3Schools)); </script>
<html> <head></head> <body> <span class=mtb-price> <label Class=mtb-ofr><b class=lb1></b>AAAAA</label></span> <script> var sku = document.getElementsByClassName(mtb-ofr).childNodes[1].nodeValue; alert(sku);
<html> <head></head> <body> <div class=abcd></div> <script> var y = document.getElementsByClassName('abcd'); var x = document.querySelectorAll(abcd);
<html> <head> <script type=text/javascript> document.getElementById(eee).innerHTML = 7777; </script> </head> <body> <p id=eee>aa</p> </body> </html>

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.