Hello,
i have this piece of code that counts the number of words in a td based off the class of the td. It works find if all the words inside the td's are the same, but if i change one, it doesnt work.
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var totaltr = $(".ms-vb2")
if(totaltr.html()== "link"){
var htmlBlock = "<strong>" + totaltr.length + " ITEMS</strong>";
totalProductList.innerHTML += htmlBlock;
}
});
</script>
</head>
<body>
<table id="catlist_ul">
<tr><td class="ms-vb2">link</td></tr>
<tr><td class="ms-vb2">link</td></tr>
<tr><td class="ms-vb2">link</td></tr>
<tr><td class="ms-vb2">link</td></tr>
<tr><td class="ms-vb2">link</td></tr>
<div id="totalProductList"></div>
</table>
</body>
</html>
If i change on of the link to links, it doesnt write it? what can be going wrong?