0
我可以在DOM中打開一個外部頁面。用jQuery變量填充輸入(輸入接收html代碼)
但我想從一個div獲取所有的子標籤,並將其保存到JavaScript變量,然後打印變量輸入值
我需要在輸入保存的div所有HTML內容和子標籤:
<form method="POST" action="test.php">
<input id="content" type="text" name="content" value="<script>document.write(content)</script>">
<input type="submit" value="submit">
</form>
<div id="mydiv"></div>// here load external page
<script>
$(document).ready(function(){
$("#mydiv").load("index.html"); // load external page in Dom
var content = $(this).closest('#div1');
/* find all parents tags e content of div id="div1"
(This is inside the external index.html file) */
});
</script>
我沒有得到它,我不知道我要去哪裏錯在上面的代碼中
感謝