jqueryまたはjsを使用した現在のページのコンテンツを取得する方法
-
01-10-2019 - |
質問
取得する方法 <head>
現在のページのコンテンツ
解決
このようなJavaScript Dom APIを使用できます。
var headContent = document.getElementsByTagName('head')[0].innerHTML;
他のヒント
使用できます 要素セレクター 取得するため <head>
, 、 例えば:
$("head")
//for example:
alert($("head").html()); //alerts the <head> children
単に:
document.head
//オブジェクトDOMオブジェクトを返します
document.head.innerHTML
//テキストを返します: 'u003Ctitle>ページのタイトル...」
所属していません StackOverflow