我有一个保存为 ahblog.htm
的 'htm' 文件,在这个文件中是一个 td
元素,类名 content topContent topContentBox
。我想要做的是将 td
元素放入名为 wrap
的主代码中的 div
中。以下是我得到的但不起作用。如果有人可以帮助我,我将非常感激。
$('document').ready(function () {
$('#wrap').load('site/ahblog.htm .content topContent topContentBox');
});
下面是我的一些“php”代码。
<?php
include( 'site/simple_html_dom.php');
$html=file_get_html( 'http://achievementhunter.com/blog/');
$html->save('site/ahblog.htm')
?>
<script type="text/javascript" src="site/jquery.js"></script>
<script type="text/javascript">
$('document').ready(function() {
$('#wrap').click(function (event)
{
event.preventDefault();
});
$('#wrap').load('site/rtnews.htm #postsArea');
});
</script>
</head>
<body>
<div id="wrap">
</div>
最佳答案
我猜你正在尝试做这样的事情:
$.get('site/ahblog.htm', function(html){
$(html).find('.content.topContent.topContentBox').appendTo('#wrap');
});
关于javascript - 使用jquery将带有类名的外部td放入div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20635652/