I am sharing two different examples here in this post showing how to add the contentEditable attribute or property to a P element using JavaScript and jQuery. ...
There are many ways you can split a string dynamically into multiple lines on your web page. You can use \n within a string, and occasionally using a combination of .split() and .join() methods ...
You can use the maxlength attribute within an input element like textarea or a textbox, to limit the character input, including copy paste. It is also possible using a simple script written in jQuery ...
We often use a textarea element in a form, to allow users to enter multi line text. Multi line texts will have line breaks, that is, you type a sentence and then hit the enter key to go to the next ...
I knew how to do this. However, I still couldn’t recollect when I needed this. So, I thought I should share this quick tip post on how to add multiple cases in a switch statement in JavaScript. ...
I have previously shared an article here explaining how to print HTML table with image using JavaScript. Now, here in this article I’ll show you how to print the contents of a DIV element with images ...
You can place or add a text over an image using HTML and CSS. The method is simple. All you need is a container like a DIV element, which will have an image and text (in another DIV element). Using ...
In JavaScript, you can use the “.createElement()” method to create any element dynamically. Now, there are two simple methods that you can use in JavaScript to add class to the dynamically created ...
You can use window.close() method to close the current browser tab/window in JavaScript. However, the method should be used with window.open() method. The .close() method will close a tab or ...
You can use the “innerHTML” attribute in JavaScript to add or append an HTML code dynamically to a DIV element (or any element). Let’s see some examples. ...