Parent is just opposite to empty
has checks element where as contains checks string
Code:
<table border="1">
<tr>
<td>Value 1</td>
<td>
<p></p>
</td>
</tr>
<tr>
<td>Value 2</td>
<td></td>
</tr>
</table>
<p>
<span>
<p>
hahaha
</p>
</span>
</p>
<style type="text/css">
td
{
width: 40px;
background: green;
}
</style>
<script type="text/javascript">
$(document).ready(function () {
$("td:parent").fadeTo(1500, 0.33);
$("td:empty").fadeTo(3000, 0.11, function () {
$(this).css({ backgroundColor: "red" });
});
$("td:has(p)").css({ backgroundColor: "black" });
$("p:contains('haaha')").css({ backgroundColor: "black" }, {color:"white"});
});
</script>
Done :)
has checks element where as contains checks string
Code:
<table border="1">
<tr>
<td>Value 1</td>
<td>
<p></p>
</td>
</tr>
<tr>
<td>Value 2</td>
<td></td>
</tr>
</table>
<p>
<span>
<p>
hahaha
</p>
</span>
</p>
<style type="text/css">
td
{
width: 40px;
background: green;
}
</style>
<script type="text/javascript">
$(document).ready(function () {
$("td:parent").fadeTo(1500, 0.33);
$("td:empty").fadeTo(3000, 0.11, function () {
$(this).css({ backgroundColor: "red" });
});
$("td:has(p)").css({ backgroundColor: "black" });
$("p:contains('haaha')").css({ backgroundColor: "black" }, {color:"white"});
});
</script>
Done :)
Comments
Post a Comment