In the following example, we will enter some random number in the input field and upon click of a button, we will convert that number into words and display it on the screen. Please have a look over the code example and the steps given below.
HTML & CSS
We have a few elements in the HTML file and that includes div, button, input, and h1. The div element with a class of container is just a wrapper for the rest of the elements.
The inner text for the button element is “Convert” and for the h1 element, it is “Output”.
We have downloaded the number-to-words library and included it in the HTML file using the script tag at the bottom.
We have done some basic styling using CSS and added the link to our style.css stylesheet inside the head element.