[英]How to remove class from TD in table by clicking on button/Div using jquery?
[英]Remove div and table from td element using jquery
我有一个名为'ahblog.htm'的文件,在这个文件中包含'td元素'。 我使用'jquery'来提取'td元素'(内容topContent topContentBox)并将其放入'div'。 我遇到的问题是从'td元素'中删除'div'和'table'。
下面是我的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/ahblog.htm .content.topContent.topContentBox');
});
</script>
下面是'td元素'
<div id="wrap">
<td class="content topContent topContentBox" height="100%" width="100%" valign="top">
<div class="titleLine"> <----- I want to remove this one
<div style id="streamDivLeveljournal43125372">
<div style id="streamDivLeveljournal100703120097">
<div style id="streamDivLeveljournal823117600">
<div style id="streamDivLeveljournal43115856">
<div style id="streamDivLeveljournal100703110797">
<table width="100%">...</table> <----- I want to remove this one
</td>
</div>
我遇到的问题是删除表,因为有多个表,并且因为它没有'ID'。 如果有人帮助我,我会非常感激。
$(".content.topContent.topContentBox").find(".titleLine, table").remove();
应该这样做。
试试这个:
$('#wrap td').find('.titleLine').remove();
$('#wrap td').find('table').remove();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.