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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T10:09:29+00:00 2026-06-16T10:09:29+00:00

Think I’m missing something bleeding obvious here and would appreciate any help. Thanks in

  • 0

Think I’m missing something bleeding obvious here and would appreciate any help. Thanks in advance.

I have the following code however when I run it breaks and says that .textContent cannot be applied to queryString because queryString is undefined.

What is throwing me however is that if I break the code just before this line and look at queryString it is storing the correct value which is ".titlearea .pagetitle". Why is this not translating in subsequent line?

The JSON object is converted into an object which returns two properties that I wish to use. A property called termName and another called definition. I want to replace the textContent of the two HTML elements with the values of these parameters.

I have stored the value of termName and definiton in an array called content. I do this in the for...in loop.

I then want to loop through this array and replace the relevant HTML element with the relevant value from the content array. This is the second for loop.

I basically want the line to be interpreted as:

document.querySelector(“.titlearea .pagetitle”).textContent = xxxx;

Where xxxx is the queryResult[i] value.

Here is the full code.

var searchTerm = JSON.parse(Result.responseText);
var DefDiv = ".titlearea .pagetitle";
var DescDiv = ".titlearea .pagesubtitle";
var holder = [DefDiv, DescDiv];
var content = [];
var x;

// Push the query into an array
for (x in searchTerm.terms[0].term) {
    content.push(x);
}

var displayResult = function(queryResult) {

    for (var i = 0; i <= holder.length; i++) {
        var queryString = holder[i];

        document.querySelector(queryString).textContent = queryResult[i];
    }
};

displayResult(content);
  • 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-16T10:09:30+00:00Added an answer on June 16, 2026 at 10:09 am

    You tagged this as Windows 8, so I’m going to assume you’re using some form of Internet Explorer. The thing is, some versions of IE don’t support querySelector or querySelectorAll. I think this is your problem. Try logging these two methods and see what it says. If it returns undefined then there is no native support in that browser for those methods.


    So it turns out it was because your were looping while using <= as part of the loop termination condition instead of < which I pointed out earlier but wasn’t sure of that being the cause of the problem. Glad I could help anyway.

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

Sidebar

Related Questions

I think, the following can't be done in Java. But I would be happy
Think about doing this: import matplotlib.pyplot as plt plt.plot(x_A,y_A,'g--') plt.plot(x_B,y_B,'r-o') plt.show() How would you
Think I have an integer array like this: a[0]=60; a[1]=321; a[2]=5; now I want
Think about the following: Your ISP offers you a dynamic ip-address (for example 123.123.123.123).
I think I have a basic understanding of this, but am hoping that someone
I think this could be a very easy question for you. But I have
Think google have a limitation for user , so users have to login to
Think of the following code: static int Main() { byte[] data = File.ReadAllBytes(anyfile); SomeMethod(data);
Think of the following services on one box: SOCKS proxy HTTP proxy SSH service
Think 2 entities OneToOne mapped. Person and Car. A Person can have a Car.

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.