在 html 页面中加载 jquery 脚本时遇到问题。当我调试某些值会变成红色但它们不会。我究竟做错了什么?仅供参考,这是我试图在 Visual Studio 中复制的内容:http: //jsfiddle.net/jfriend00/GAwrB/
<html>
<head>
<title></title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$(".colorMe td").each(function() {
var valueInTd = $(this).text();
if (valueInTd < 3000) {
$(this).css('background-color', '#F00000');
}
});
});
</head>
<body>
<table class="colorMe">
<tr><td>2000</td><td>3500</td></tr>
<tr><td>3000</td><td>2500</td></tr>
<tr><td>4000</td><td>4500</td></tr>
</table>
</body>
</html>