Front End Technology Articles

Page 418 of 652

How can I trigger a JavaScript click event?

Prabhas
Prabhas
Updated on 15-Mar-2026 2K+ Views

In JavaScript, you can programmatically trigger a click event on an element using the click() method. This is useful for automating user interactions or creating custom behaviors. Using the click() Method The click()

Read More

Can we make print button without JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 1K+ Views

In this tutorial, we will learn to make a print button without writing separate JavaScript files. Most websites have print functionality that opens the browser's print dialog when clicked. While HTML doesn't have a built-in print method, we can use the window.print() method directly in HTML attributes. This allows us to create print functionality without external JavaScript files. Syntax The basic syntax for invoking the print method: window.print(); // Opens browser's print dialog Using the onClick Event We can call window.print() directly in HTML using the onClick event attribute. Syntax ...

Read More

How to find out which JavaScript events fired?

Abhishek
Abhishek
Updated on 15-Mar-2026 16K+ Views

In this tutorial, we will learn how we can find out which JavaScript event is fired or triggered. We can add events to HTML elements to perform some actions on the webpage like changing text, form submission, etc. There are two ways of finding which JavaScript event is fired − Using Developer Tools Using Inspect Element Let us discuss both of them one by one with coding examples. Using Developer Tools We can find out which JavaScript event is fired by using developer tools in the browser. ...

Read More

What is the difference between local storage vs cookies?

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

Local storage and cookies are two different ways to store data in web browsers, each with distinct characteristics and use cases. Understanding their differences helps you choose the right storage mechanism for your web application. Storage Capacity Local storage offers significantly more storage space than cookies: Local Storage: Typically 5-10 MB per domain Cookies: Limited to 4 KB per cookie, with a maximum of about 20 cookies per domain Server Communication The key difference lies in how they interact with servers: // Local Storage - stays on client side localStorage.setItem('username', 'john_doe'); ...

Read More

How to secure my JavaScript using "Strict mode"?

Prabhdeep Singh
Prabhdeep Singh
Updated on 15-Mar-2026 289 Views

In this tutorial, we are going to learn how to secure my JavaScript using "Strict mode". There are some errors in the code which are just ignored by the JavaScript engine and if any line fails it performs nothing. To indicate that there is an error we can use strict mode which will make the JavaScript engine throw an error. The 'use strict' is a literal expression which is a directive we can add to the code. We can add this 'use strict' directive to the whole script, a function, or a class. Syntax Now let's see ...

Read More

How much data can I store in JavaScript cookies?

varma
varma
Updated on 15-Mar-2026 557 Views

JavaScript cookies have size and quantity limits that vary by browser. Understanding these constraints is essential for effective web storage planning. Cookie Storage Limits by Browser Each browser imposes different limits on cookie storage. Here are the current limitations: Web Browser Maximum Cookies per Domain Maximum Size per Cookie Google Chrome 180 ...

Read More

How to set a cookie and get a cookie with JavaScript?

Sreemaha
Sreemaha
Updated on 15-Mar-2026 4K+ Views

JavaScript cookies allow you to store small pieces of data in the user's browser. You can set cookies using document.cookie and retrieve them by parsing the same property. Setting Cookies The simplest way to create a cookie is to assign a string value to the document.cookie object: document.cookie = "key1=value1;key2=value2;expires=date"; The "expires" attribute is optional. If you provide this attribute with a valid date or time, the cookie will expire on that date and the cookie's value will no longer be accessible. Example: Setting a Cookie This example sets a customer name ...

Read More

How to set JavaScript Cookie with no expiration date?

Prabhdeep Singh
Prabhdeep Singh
Updated on 15-Mar-2026 2K+ Views

In this tutorial, we will learn how to set JavaScript cookies with no expiration date. Cookies are small data files stored by web browsers that help websites remember user preferences and track behavior. When a cookie has no expiration date, it becomes a session cookie that lasts until the browser is closed. Understanding Cookie Expiration The expires attribute in JavaScript cookies is optional. If you don't specify an expiration date, the cookie will automatically expire when the browser session ends (when the user closes the browser). This type of cookie is called a session cookie. Syntax for ...

Read More

How do I print Unicode characters in the console using JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 4K+ Views

In this article, we will learn how to print Unicode characters in the console using JavaScript. Unicode assigns a unique number (code point) to each character, enabling consistent representation across different platforms and languages. Unicode is a universal character encoding standard that includes letters from most writing systems, punctuation marks, mathematical symbols, technical symbols, arrows, emoji, and other symbols. JavaScript provides several ways to work with Unicode characters in strings and console output. Using Escape Sequences JavaScript supports Unicode escape sequences to represent characters using their code point numbers. The most common format uses \u followed by ...

Read More

How do I print a message to the error console using JavaScript?

Ali
Ali
Updated on 15-Mar-2026 364 Views

To print messages to the browser console in JavaScript, use the console object. Different methods display messages with varying styles and importance levels. Basic Console Methods Here are the main console methods for displaying messages: console.log("This is a regular message"); console.error("This is an error message"); console.warn("This is a warning message"); console.info("This is an info message"); This is a regular message This is an error message (displayed in red) This is a warning message (displayed in yellow/orange) This is an info message (displayed in blue) Error Console Specifically To print specifically ...

Read More
Showing 4171–4180 of 6,519 articles
« Prev 1 416 417 418 419 420 652 Next »
Advertisements