I have a table with a couple of rows, each row with two columns, the first column will hold title and second column will have the respective values.sometimes, cells in the right
Your selector will cause the if statement never to be true for any row in your example. You should remove the double negative (the $("td:not(:empty)") always selects the element with the title, so length is always 1. if(!1) is never true.
! and the :not) to make it clearer, and then check that the length (i.e. number of matched elements) is > 0.