[英]HTML/Javascript - Access contents of the data tag of an <object>
What is the easiest way to access the data within the <body>
tag in this Screenshot using JavaScript/JQuery? 使用JavaScript / JQuery访问此屏幕快照中 <body>
标记内的数据的最简单方法是什么?
I need to return the content as a string, json or html file structure in my script. 我需要在脚本中以字符串,json或html文件结构返回内容。 The file ("bib_chi.html") looks like this . 文件(“ bib_chi.html”)如下所示 。
I don't know how to specify my query so that it returns the contents of the <body>
tag. 我不知道如何指定查询,以便它返回<body>
标记的内容。
What I've tried so far (and didn't work): 到目前为止,我已经尝试过(但没有成功):
$("#bibTex");
see 1st image 见第一张图片 $("#bibTex").contentDocument.body;
returns empty <body></body>
返回空的<body></body>
$("#bibTex").contents();
returns a file structure that I don't know how to work with 返回我不知道如何使用的文件结构 $("#bibTex").text();
returns an empty string 返回一个空字符串 $("#bibTex").html();
returns an empty string 返回一个空字符串 $("#bibTex").innerHTML
returns 'undefined' $("#bibTex").innerHTML
返回'undefined' I am grateful for every piece of advise. 我感谢每一个建议。
Thanks in advance! 提前致谢!
Just use the DOM-Attribute innerHTML or the jQuery Method text(). 只需使用DOM属性innerHTML或jQuery方法text()。 For more information: http://api.jquery.com/text/ 有关更多信息: http : //api.jquery.com/text/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.