If I have this page a.html that has all the jquery codes. And there is another page b.html that has only html tags. Is it possible to do something like:
alert( $('a').fromhref('b.html').html() );
Basically I want to select a tag from another page. I want to basically avoid the use of iframes and httprequests.
You can access parts of another page with jQuery, provided both pages are on the same domain, using
load(), but this can only be done with an http request (though if the page is cached, it might not be necessary), as a brief example:This will load the html of the element with an
idofidOfElementOnPageBinto the element with theidofidOfElementOnPageA.But please note, this in no way avoids making a call to the server, though it does allow you to retrieve elements from another page without using
iframeelements in your page.References:
load().