I’ve been messing with some table with a lot of numbers, and one thing that came up is that I need to select all cells which have zero, or not zero. Sounds straight forward but there could be multiple variations of zero (0, 0.0, 0.000, .0, etc..). Here is a couple quick selectors to check for this (or any number, not just zero):


$.expr[":"].numbereq = function(obj, index, meta, stack){
	return parseFloat((obj.textContent || obj.innerText || $(obj).text() || "")) == parseFloat(meta[3]);
}

And you would call it like this:


$(".myel:numbereq(0)");

And since that was so easy I figure I might as well do the not equals as well..


$.expr[":"].numberneq = function(obj, index, meta, stack){
	return parseFloat((obj.textContent || obj.innerText || $(obj).text() || "")) != parseFloat(meta[3]);
}

And you would call it like this:


$(".myel:numberneq(5)");

There you go, a pretty quick, simple selector to help out when dealing with numbers as your text content of nodes.