How to use "Grammarly.js" for spelling test?

Asked 09-Feb-2023
Updated 09-Feb-2023
Viewed 224 times

1 Answer


Grammarly.js is a JavaScript library designed for web applications that provides an easy-to-use spelling and grammar checker. With its intuitive interface, Grammarly.js makes it easy for developers to add spell-checking and grammar-checking capabilities to their web applications.

To start using Grammarly.js, you will first need to sign up for a Grammarly account and obtain an API key. This key will be used to access the Grammarly.js library and perform spell and grammar checking. Once you have your API key, you can include the Grammarly.js library in your HTML code by adding the following code to the head section of your page:

<script src=""></script>
 window.grammarly = new window.Grammarly();

Next, you can add a text area to your HTML form where users can enter text to be checked. You can use the following code to create a simple text area:

<textarea id="text-input"></textarea>

Now that you have a text area for users to enter text, you can use Grammarly.js to check the spelling and grammar of the text. To do this, you will need to call the check() method of the Grammarly object. You can pass the text to be checked as a parameter to this method. The following code demonstrates how to perform a spell and grammar check:

 var text = document.getElementById("text-input").value;
 window.grammarly.check(text, function (err, results) {
   if (err) {
   } else {

How to use Grammarlyjs for spelling test

The check() method returns an object that contains the spelling and grammar results for the text. You can use this object to display the results to the user or to perform other actions, such as highlighting mistakes in the text.

In conclusion, Grammarly.js is a powerful tool for adding spell and grammar-checking capabilities to web applications. Whether you are creating a content management system, a blog, or any other type of web application, Grammarly.js can help ensure that your users produce high-quality, error-free content. With its easy-to-use interface, Grammarly.js makes it simple for developers to add this functionality to their web applications and improve the quality of the content produced by their users.