使用jquery删除td类

remove td class using jquery

本文关键字:td 删除 jquery 使用      更新时间:2023-09-26

我有一个包含td class='small'div,我想使用jQuery来删除它。

<td class="small" style="padding:8px 0;color:#999;vertical-align:middle;">
A bunch of gibberish...
</td>

在我的主代码中,我使用jQuery从文件中提取div,然后用提取的替换主代码中的div

<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8">
<meta http-equiv="content-language" content="en">
<meta name="viewport" content="width=500" />
<title>Rooster Teeth News</title>
<link rel="stylesheet" type="text/css" href="site/wwwRand1.css">
<?php 
include( 'site/simple_html_dom.php'); 
$html=file_get_html( 'http://roosterteeth.com/home.php'); 
$html->save('site/result.htm')                      
?>
<script type="text/javascript" src="site/jquery.js"></script>
<script type="text/javascript">
$('document').ready(function() {    
$('#postsArea').load('site/result.htm #postsArea');
});
</script>
</head>
<body>
<div id="wrap">
<div id="postsArea"></div>
</div>

我遇到的问题是,只有在"div"被替换后,我才能删除"td"。如果有人能帮我,我将不胜感激。谢谢。

load()方法有一个回调函数,因此您可以使用:

$('#postsArea').load('site/result.htm', function(){
    $('#postsArea td.small').removeClass('small')
});