jquery-获取不同的页面元素 [英] jquery- get different page elements
本文介绍了jquery-获取不同的页面元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想获取属于其他html页面的元素属性值。
I want to get element attribute value which belongs to other html page.
例如,如果我在文件 a.html 中想要从 a.html
For example if I am in file a.html and want to get data like element attribute value from b.html in a.html
所有我想要的在jquery做。
All I am trying to do in jquery.
请建议!
我读过帖子但我想在下面 -
I read posts but I want like below-
类似于 - >
[a.html代码]
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?
推荐答案
首先你需要获取 b.html
,然后你可以找到属性值,例如
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");
});
这篇关于jquery-获取不同的页面元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文