Select Page

Tag: JavaScript

Allow numbers and new line in textarea using JavaScript

Allow numbers and new line in textarea using JavaScript

Textareas are commonly used in web forms to allow users to enter multi-line text input. By default, textareas allow users to enter any character they want, including letters, numbers, symbols, and line breaks. However, in some cases, you may want to restrict the input...

How to create HTML hidden templates in a page?

We can create an HTML hidden template using the following method that we can add anywhere in the page. After creating a template we can now use it, modify it, and append/prepend it’s html anywhere in the page. <script id=”imageTemplate”...

How to know the length of the path in SVG?

How to know the length of the path in SVG to animate it with the stroke offset method? Well, the answer is very simple. Just use the following JavaScript and update its selector to that of the path you want to calculate the length of. Check the length value in the...