![Allow alphabets and space only in text field](https://i0.wp.com/webdevpuneet.com/wp-content/uploads/2023/02/alphabets-and-space-in-input-text-fiels.png?resize=447%2C200&ssl=1)
Category: JavaScript
Posts that are JavaScript-oriented.
![Allow alphabets and space only in text field](https://i0.wp.com/webdevpuneet.com/wp-content/uploads/2023/02/alphabets-and-space-in-input-text-fiels.png?resize=447%2C200&ssl=1)
How to use “MutationObserver API” to observe the changes to the target node
In this article, we will explore how to write a script in JavaScript to detect if a node is inserted or removed in an element. One way to detect if a node is inserted or removed is to use the MutationObserver API. This API provides a way to observe changes to the DOM...How to detect if node is added or removed inside a DOM element
document.getElementById(“myDiv”).addEventListener(“DOMNodeInserted DOMNodeRemoved”, function(event) { console.log(“A new node has been inserted or removed.”); }); To use these events, you can bind a function to the DOMNodeInserted...![How to restrict textarea inputs to max 10 numbers in a line?](https://i0.wp.com/webdevpuneet.com/wp-content/uploads/2023/02/Screenshot_13.png?resize=516%2C225&ssl=1)
How to restrict textarea inputs to max 10 numbers in a line?
Here is an example of how to restrict the input of a textarea to a maximum of 10 numeric characters per line, and allow line breaks (newlines) using HTML and JavaScript, while also ensuring that the restriction works during copy-paste: HTML <textarea...![How to allow only numeric digits in an input field?](https://i0.wp.com/webdevpuneet.com/wp-content/uploads/2023/02/input-with-numbers.png?resize=447%2C213&ssl=1)
How to allow only numeric digits in an input field?
Allowing only numeric digits in an input field can be useful in many web development projects, especially when working with forms and data input. HTML and JavaScript can be used to achieve this task easily. Here is the HTML code to create a simple input field:...![Responsive text with respect to container width](https://i0.wp.com/webdevpuneet.com/wp-content/uploads/2022/11/Screenshot_20.png?resize=1032%2C603&ssl=1)