我有一個div
其中包含一個td class='small'
我想用jQuery來刪除它。使用jquery刪除td類
<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'。如果有人可以幫助我,我會非常感激。謝謝。
$( 'td.small')removeClass( '小'); –
如果元素是新的ajax內容的一部分,則需要使用'load()'的回調...請參閱文檔 – charlietfl
感謝您的幫助 – Sabre