Skip to content

Instantly share code, notes, and snippets.

@abrarfahad
Last active May 16, 2019 07:23
Show Gist options
  • Save abrarfahad/6e8422de6d07500a978cd4ec421bef9c to your computer and use it in GitHub Desktop.
Save abrarfahad/6e8422de6d07500a978cd4ec421bef9c to your computer and use it in GitHub Desktop.
this program will select the 3rd column cells of table and go through each cell of that column and compare to the adjacent next cell value. if that condition matches the background color of next cell will be green otherwise print the ratio.
var tdlist = jQuery("tr td:nth-child(3)");
tdlist.each(function() {
//console.log($( this ).text().trim().replace(',','')/2.5);
//console.log($( this ).next().text());
if($( this ).next().text()==$( this ).text().trim().replace(',','')){
$( this ).next().css("background-color", "green");
}else{
console.log($( this ).next().text()/$( this ).text().trim().replace(',',''));
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment