I am looking for a javascript that shows the % of the keyword density when the text is written.

For example :

I have a Keyword : "This is a day"

My Text is " This is a day that is really important for us so this is the day we are waiting for a long time now something. "

Here the Total Words is 24 and the Keyword used is 2wice

So the keyword density would be 10%.

Can anyone help me with the javascript that takes the total count of words from the textarea and then calculates it according to the keywords used and show the percentage.

Any help would be highly appriciated. Thanks all in advance.