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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:28:18+00:00 2026-06-04T04:28:18+00:00

I have a string of HTML that I use as jQuery input document. //

  • 0

I have a string of HTML that I use as jQuery input document.

// the variable html contains the HTML code

jQuery( html ).find( 'p' ).each( function( index, element ) {
    // do stuff
});

Though, I keep getting errors that the images doesn’t exist (in my variable html). The images in the HTML have relative URL’s which doesn’t correspond to images on my host, so naturally, they can’t be found so I get 404 errors in my console.

Is there a jQuery-way to avoid jQuery loading the images? If not, I’ll have to find all images and replace the src using non-jQuery which is a bit sad because that’s exactly where jQuery comes in handy :p


Edit:

I’ll explain step by step.

I have a variable, html, that contains some HTML code from another site. I put that variable in the jQuery constructor, because I want to perform actions on that HTML.

jQuery( html );

At this point I get 404 errors because the images in the HTML source are relative; they don’t correspond to the images I have on my host.

  • I can’t use jQuery to remove the src tag, because I still get errors
  • Writing a bit of javascript to modify the src value is plain silly; this is why I use jQuery

So, again, all I’m asking is if there’s a setting or whatever that avoids jQuery from loading the images in the supplied source.

Thank you.

  • 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-04T04:28:19+00:00Added an answer on June 4, 2026 at 4:28 am

    To stop images loading you need to modify html before creating jQuery( html ) object. You can use jquery for that also.

    var newhtml = html.replace('src=','nosrc=');
    jQuery( newhtml ).find( 'p' ).each( function( index, element ) {
        // do stuff
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have a string of HTML code. I want to use JQuery to
I have a string of text that contains html, and I need to extract
If I have a string that contains the html from a page I just
I have a AJAX request that will return a string that contains some HTML
I have an HTML string that contains text and images, e.g. <p>...</p> <img src=...
i have string stored in python variables, and i am outputting a html that
Background: I have string of html with about 10 image tags that passes through
I have a some of html strings that my application generates. Each html 'snippet'
I have the following HTML code stored in a javascript string: and I am
How would you convert following code to use only jquery library? <html> <head> <script>

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.