我需要获取带有<div>标签和所有内容的原始 html,并将其放入变量字符串中。
所以如果我有一个单独的文件 test.html
<div>
<div><img src="images/htc_hero_wallpaper_01.jpg" width="20%" height="20%" alt="" /></div>
WORKS!!!
</div>
Run Code Online (Sandbox Code Playgroud)
我需要 jQuery 命令
$.ajax({
url: "test.html",
success: function(){
var htmlraw = ?????
alert(htmlraw) /// should print the raw test.html
}
});
Run Code Online (Sandbox Code Playgroud)
打印
<div>
<div><img src="images/htc_hero_wallpaper_01.jpg" width="20%" height="20%" alt="" /></div>
WORKS!!!
</div>
Run Code Online (Sandbox Code Playgroud) 父div中有几个子div.我想展示/隐藏一个特定的孩子.
<div id="parent">
<div id="child0">Text here</div>
<div id="child1">Text here</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我希望鼠标在div id ="parent"上显示hide div id = child0,父div中的其他所有内容保持不变(可见).