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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:34:16+00:00 2026-05-23T16:34:16+00:00

My problem is the following, I use jquery to get div content but .find()

  • 0

My problem is the following, I use jquery to get div content but .find() return null.

We can view the source code here: http://webdevs-bg.net/web/html5pload/js.html and open your console to view the log from find().

  • 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-23T16:34:17+00:00Added an answer on May 23, 2026 at 4:34 pm

    Your response is returning an entire HTML document. Don’t do that. You’ll have trouble traversing it because different browsers behave differently when dropping an entire document into a jQuery object.

    A temporary fix may be to use the filter()[docs] method instead of .find().

    I’m guessing you’re testing on a browser that strips out everything but the content of the <body>, leaving the "#content" element at the top level where .find() can’t locate it.

    Note that this won’t work in all browsers, which is why you’d need to only return the content you actually want.

    Also, you’re appending a new element with #content to an existing element on the page with the same ID. I assume you’d only want to append its children.

    $.get(History.getState().url, {
        text: "123"
    },
    
    function (response) {     //   v--filter will work in some browsers, but not all
        var $content = $response.filter("#content"); 
        $("#content").empty().append($content); // <-- appending #content to #content?
        console.log('content is: ', $content);
    });
    

    This should be your response:

    <h3> JS файл </h3> 
    

    …but instead you sent this:

    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="UTF-8"/>
            <script type="text/javascript" src="jquery.js"> </script>
            <script type="text/javascript" src="history/amplify.store.js"> </script>
            <script type="text/javascript" src="history/history.adapter.jquery.js"> </script>
            <script type="text/javascript" src="history/history.js"> </script>
        </head>
        <style type="text/css">
            body {
            padding: 10px;
            }
        </style>
        <body>
    
            <script>
                var History = window.History;
                $(function() {
                History.Adapter.bind(window,'statechange', function() {
                $.get(History.getState().url, {text: "123"}, 
    
                function(response) {
                var $response = $(response);
                var $content = $response.find("#content");
                $("#content").empty().append($content);
                console.log($content);
    
                });
                });
                $("a").click(function() {
                History.pushState(null, null, $(this).attr("href"));
                return false;
                });
                });
            </script>
            <a href="ffmpeg.php">Начало</a> | <a href="js.html">JSинг</a>
            <div id="content">
                <h3> JS файл </h3>  <!-- <<--THIS should be your response -->
            </div>
            <div id="c2">footer</div>
        </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm struggling with the following problem. I use the jQuery autocomplete plugin to get
Trying to use JSTL but have the following problem: Index.xhtml page: <?xml version=1.0 encoding=UTF-8?>
I'm having a problem with image scaling. When I use the following code to
i've got the following Problem / Question: I have HTML Code like this: <div
I have the following JQuery code that processes a GET request upon page load:
Hi i use the following simple jquery script to append input. Source http://muiomuio.com/web-design/add-remove-items-with-jquery <html
I have the following problem: I need to use XSLFO to generate a 2-column
When I use make command, like make mica2, in TinyOS. The following problem will
I'm refactoring a library we currently use, and I'm faced with the following problem.
I wonder if anyone can help with a jQuery problem I am having. I

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.