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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:48:24+00:00 2026-06-11T01:48:24+00:00

Using jQuery to create new DOM elements from text. Example: jQuery(‘<div><img src=/some_image.gif></img></div>’); When this

  • 0

Using jQuery to create new DOM elements from text.

Example:

jQuery('<div><img src="/some_image.gif"></img></div>');

When this statement is executed, it causes the browser to request the file ‘some_img.gif’ from the server.

Is there a way to execute this statement so that the resulting jQuery object can be used from DOM traversal, but not actually cause the browser to hit the server with requests for images and other referenced content?

Example:

var jquery_elememnts = jQuery('<div><img class="a_class" src="/some_image.gif"></img></div>');
var img_class = jquery_elememnts.find('img').attr('class');

The only idea I have now is to use regex to remove all of the ‘src’ tags from image elements and other things that will trigger the browser requests before using jQuery to evaluate the HTML.

How can jQuery be used to evaluate HTML without triggering the browser to make requests to the server for referenced content inside the evaluated HTML?

Thanks!

  • 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-11T01:48:26+00:00Added an answer on June 11, 2026 at 1:48 am

    if you do the regexp way, maybe a simple one like

        htmlString.replace(/[ ]src=/," data-src=");
    

    will do the job ?

    so instead of looking for :

        jquery_elememnts.find('img').attr('src');
    

    you will have to look for :

        jquery_elememnts.find('img').data('src');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating DOM elements dynamically (more specifically, using jQuery to create a DIV containing
I create one table by using jquery : <div class=productlist style=float:left; id=productlist> <script type=text/javascript
I remember well that using the DOM implementation to create new HTML elements on
Hello i'm using map() jquery to create a new object array DEMO but this
I want to use jQuery to create a new div on the page when
Sometimes, it is useful to create DOM elements as jQuery objects for use as
I'm using the jQuery template engine to add dynamic DOM elements (specifically DIVs). To
I am using jquery to create a custom dropdown with the code below. I
I am using jquery to create two sets of tabs on a page. The
I am using jQuery mobile to create the following page. http://ielts.progmic.com/iOS/college.php?title=Royal+College+Of+Arts In the link

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.