jquery- get different page elements
I want to get element attribute value which belongs to other html page.
For example if I am in file a.html and want to get data like element attribute value from b.html in a.html
All I am trying to do in jquery.
Please suggest!
I read posts but I want like below-
something like->
[Code of a.html]
var result = get(b.html).getTag(img).getAttribute(src)//not getting exactly
$("#id").append(result)
any idea how can i achieve this?
first you will have to fetch the b.html
and then you can find the attribute value e.g.
//if you dont want to display the data make the div hidden
^
$("#someDivID").load("b.html",function(data){
var value=$(data).find("#elementID").attr("attributeName");
});
With jQuery you can load only parts of remote pages. Basic syntax:
$('#result').load('ajax/test.html #container');
The second part of the string is a basic jQuery selector. See the jQuery documentation.