javascript - Remove div and table from td element using jquery - Stack Overflow

I have a file named 'ahblog.htm' and inside this file contains a 'td element'. I am

I have a file named 'ahblog.htm' and inside this file contains a 'td element'. I am using 'jquery' to extract the 'td element' ( content topContent topContentBox) and put it into a 'div'. The problem I am having is removing a 'div' and 'table' from inside the 'td element'.

below is my php code

<?php 
include( 'site/simple_html_dom.php'); 
$html=file_get_html( '/');
$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>

below is the 'td element'

<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>

The problem I am having is removing the table as there are multiple tables, and because it doesn't have an 'ID'. If any one coud help me I will really appreciate it.

I have a file named 'ahblog.htm' and inside this file contains a 'td element'. I am using 'jquery' to extract the 'td element' ( content topContent topContentBox) and put it into a 'div'. The problem I am having is removing a 'div' and 'table' from inside the 'td element'.

below is my php code

<?php 
include( 'site/simple_html_dom.php'); 
$html=file_get_html( 'http://achievementhunter./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>

below is the 'td element'

<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>

The problem I am having is removing the table as there are multiple tables, and because it doesn't have an 'ID'. If any one coud help me I will really appreciate it.

Share asked Dec 17, 2013 at 17:16 AstonAston 1991 gold badge3 silver badges18 bronze badges 2
  • Why don't you add an ID? – Dan Grahn Commented Dec 17, 2013 at 17:17
  • Why don't you add an id ? Try $(#wrap table) – Ricardo Lohmann Commented Dec 17, 2013 at 17:17
Add a ment  | 

2 Answers 2

Reset to default 3
$(".content.topContent.topContentBox").find(".titleLine, table").remove(); 

Should do it.

try this:

$('#wrap td').find('.titleLine').remove();
$('#wrap td').find('table').remove();

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745074837a4609772.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信