You can use .filter() instead for an exact match.
var result = $("#TableName tr td").filter(function() { return $.text([this]) === "222"; });
$.text() used to compare the text value of <td> with "222" . This is just a little quick way to do $(this).text() . Gives you the same result. (Note that you need to pass this to Array [this] .)
When there is a match, the element returns to the jQuery result object.
If there is any possibility of a space or space in the <td> , you can trim with $.trim() .
return $.trim( $.text([this]) ) === "222";
EDIT:. You can create your own selector that will perform the same task if you want:
$.extend($.expr[':'], { textIs: function(elem, i, attr) { return ($.trim( $.text([elem]) ) === attr[3]); } }); var result = $("#TableName tr td:textIs(222)")
source share