如何在xyz.xhtml中点击<img/>以便它能从abc.xhtml中的<p>标签中读取数据?

时间:2017-10-27 09:59:24

标签: javascript

xyz.xhtml包含图片标签。点击该按钮应在同一页面中打开一个div,并将该内容显示为其他名为abc.xhtml的文件的

标签。

1 个答案:

答案 0 :(得分:1)

I got the Solution.
You can use the following snippet to access the element from one HTML/XHTML file in another HTML/XHTML file.

function test_fun(){
  $(function(){
    $("#<id of the element in which you want to show to contents>").load("
    <name_of_file> <#ID_of_Element_you_are_accessing>");
  });
}


The space between name of file and ID of element is necessary.