'How to find frequency count of a word in a html table column and write output in a text file?
I am trying to get the frequency of each word of column 'Company Registered District' in the following table in the screenshot.
I tried this post (how to find how many times a word occurs in the html table row which is dynamically created) But I don't have any knowledge on javascript to understand or implement this in my case. Also I would like frequency of each unique word in a text list. Can I achieve this with javascript? If so, how?
Edited with code The following code from the above mentioned post works in my case. I want this modified in a way that it only looks in table-6. Also instead of searching a the occurrence of word "CC" I want frequency of each unique word and the output of each word needs to be in a text file/log instead of alert.
$(document).ready(function ()
{
getOccurance("CC");
function getOccurance(word)
{
$("table").each(function (tindx, tobj)
{
var noOfOccurance = 0;
$("tr td:gt(1)", $(tobj)).each(function (ind, obj)
{
if (word == $.trim($(obj).text())) noOfOccurance++;
});
alert("Word " + word + " occurs " + noOfOccurance + " times in table " + (tindx + 1));
})
}
})
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|