Articles on Trending Technologies

Technical articles with clear explanations and examples

How to remove html tags from a string in JavaScript?

vineeth.mariserla
vineeth.mariserla
Updated on 15-Mar-2026 8K+ Views

Removing HTML tags from strings is a common task in JavaScript web development. You can accomplish this using regular expressions to match and replace HTML tag patterns with empty strings. Understanding HTML Tag Structure HTML elements are enclosed between angle brackets like , , , etc. By targeting the pattern of content within these brackets, we can effectively strip all HTML tags from a string. Syntax str.replace(/(]+)>)/ig, ''); The regular expression /(]+)>)/ig breaks down as: ]+) - matches one or more characters that aren't closing brackets > - matches closing angle bracket ...

Read More

How to autofill a field in JavaScript same as another?

Disha Verma
Disha Verma
Updated on 15-Mar-2026 2K+ Views

Automatically filling a field in JavaScript is a common requirement in web forms, where one field copies the value from another. This feature eliminates the need to write the same information in multiple fields. This is useful in real-life scenarios, such as forms where users enter a permanent address and need to add a temporary address. If both addresses are the same, using the autofill feature, they can automatically copy the permanent address to the temporary address field. This article explains how to create autofill functionality in JavaScript. Core Concept: Copying Field Values The main concept is ...

Read More

How would I add a newline in an Unordered List (UL) from JavaScript?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 405 Views

To add a new line (list item) to an Unordered List in JavaScript, use document.querySelector().append() or appendChild(). This allows you to dynamically add elements to an existing . Basic Syntax // Create a new list item let listItem = document.createElement('li'); listItem.textContent = 'Your content here'; // Append to the ul document.querySelector('ul').append(listItem); Complete Example Add Items to List Demo h1 { ...

Read More

Implement Onclick in JavaScript and allow web browser to go back to previous page?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 508 Views

JavaScript provides several methods to implement browser navigation functionality. The most common approach is using window.history.go(-1) with an onclick event to go back to the previous page. Syntax window.history.go(-1); // Go back one page window.history.back(); // Alternative method Using window.history.go(-1) The window.history.go(-1) method navigates back one page in the browser history: Go Back Example Current Page ...

Read More

How do you launch the JavaScript debugger in Google Chrome?

Abhinaya
Abhinaya
Updated on 15-Mar-2026 358 Views

To launch the JavaScript debugger in Google Chrome, you can use several methods to access the Developer Tools and start debugging your code. Method 1: Using Keyboard Shortcut The fastest way to open the debugger is using the keyboard shortcut: Windows/Linux: Press Ctrl + Shift + J Mac: Press Cmd + Option + J Method 2: Using Chrome Menu You can also access the debugger through Chrome's menu system: Click the three-dot menu icon in the top-right corner of Chrome ...

Read More

How to set the inward offsets of the image border with JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 309 Views

In this tutorial, we will learn how to set the inward offsets of the image border with JavaScript. An image can be set in the border as a border image using CSS properties. The border image can be set using different parameters. To set the inward offsets of the image border, use the borderImageSlice property in JavaScript. We will see two different approaches to setting up the inward offsets of the image border with JavaScript − The borderImageSlice Property The setProperty Method Using the borderImageSlice Property ...

Read More

How to set all the outline properties in one declaration with JavaScript?

Monica Mona
Monica Mona
Updated on 15-Mar-2026 217 Views

To set outline properties, use the outline property. It allows you to set the color, style, and width of the outline in one declaration with JavaScript. Syntax The outline property accepts up to three values in any order: element.style.outline = "width style color"; Parameters outline-width: thin, medium, thick, or specific value (px, em, etc.) outline-style: none, solid, dotted, dashed, double, groove, ridge, inset, outset outline-color: color name, hex code, rgb(), or rgba() Example Click the button to apply an outline to the orange box: ...

Read More

Binary Search Tree in Javascript

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 504 Views

A Binary Search Tree (BST) is a specialized data structure where each node follows a specific ordering rule. A node's left child must have a value less than its parent's value, and the node's right child must have a value greater than its parent's value. 8 3 10 1 6 14 ...

Read More

Creating auto-resize text area using JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 1K+ Views

In this post, we are going to learn how to set up an auto-resize text area in JavaScript. This text area will be able to change its height automatically depending on the content within it. Auto-resize text in JavaScript is a helpful feature that can be used to edit multiple lines of text. The text can automatically change its height depending on the content inside it. The default behavior of textarea doesn't allow this, but we can create it by using the input event listener over it. Let's understand how to adjust the height of the text area element ...

Read More

How to transform JavaScript arrays using maps?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 163 Views

JavaScript's map() method creates a new array by transforming each element of the original array using a callback function. It's essential for functional programming and data transformation. Syntax array.map(callback(element, index, array)) Parameters callback - Function that transforms each element element - Current array element being processed index - Index of the current element (optional) array - The original array (optional) Basic Example: Squaring Numbers Transform Arrays with Map ...

Read More
Showing 18131–18140 of 61,297 articles
Advertisements