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.