Found 6710 Articles for Javascript

How do I remove a property from a JavaScript object?

V Jyothi
Updated on 16-Jun-2020 06:21:09

171 Views

To remove a property from a JavaScript object, use the delete keyword. You can try to run the following code to learn how to remove a propertyExampleLive Demo                          var cricketer = {             name:"Amit",             rank:1,             points: 150          };          delete cricketer.rank;          document.getElementById("demo").innerHTML =             cricketer.name + " has " + cricketer.rank + " rank.";          

How to get current URL in JavaScript?

Arnab Chakraborty
Updated on 21-Jun-2020 14:20:51

568 Views

The window.location object can be used to get the current URL.window.location.href returns the href(URL) of the current page.I am using these code in my MVC projet.Example                                          var iid=document.getElementById("dd");         alert(window.location.href);       iid.innerHTML = "URL is" + window.location.href;    

How can I remove all child elements of a DOM node in JavaScript?

Arnab Chakraborty
Updated on 11-Aug-2022 10:45:43

13K+ Views

Suppose you are building a web app that manages the data of daily tasks, the user inserts the task and a list of tasks gets formed. But at some point in time, the user wants to remove all the tasks from the list and wants to make the list empty. So, as a developer, you should know how to remove all the child elements from the DOM node. To remove all the elements from the DOM node we have the following approaches. By iterating the DOM nodes and using the removeChild method. By Erasing the innerHTML value to a ... Read More

How to determine if JavaScript object is an event?

Shubham Vora
Updated on 23-Aug-2022 08:49:40

2K+ Views

Let us first understand what is JavaScript objects and JavaScript events. An object in JavaScript is a distinct entity having properties and a type. For an instance, contrast it with a bowl. A bowl is an object with some properties. The properties are design, color, material, weight, etc. Like this, JavaScript object also has some properties. An independent entity known as a JavaScript object can store numerous values as its properties and methods. While a method represents a function, an object property maintains a literal value. Either the object literal or the object function object() { [native code] } syntax ... Read More

How to delete a row from a table using jQuery?

Saleh Alshahrani
Updated on 12-Feb-2025 19:32:34

3K+ Views

In this article, we will learn to delete a row from a table using jQuery. jQuery, a fast and lightweight JavaScript library, Deleting a row from a table dynamically is a common requirement in web development, especially when working with forms or data tables. Deleting a Row Using jQuery The approach involves attaching a click event listener to a delete button (or any element) within the row. When the button is clicked, the corresponding row is removed from the table. Following are the steps for jQuery Script for deleting a row from a table using jQuery− ... Read More

How to add a new list element under a \'ul\' using jQuery?

Alshifa Hasnain
Updated on 15-May-2025 19:38:04

3K+ Views

In this article, we will learn to add a new list element under a "" using jQuery. jQuery is a popular JavaScript library that simplifies HTML manipulation, event handling, and animations. One of its practical applications is dynamically adding elements to a webpage without requiring a full page reload. Why Use jQuery? DOM (Document Object Model) updating using basic JavaScript might become difficult and needs more than one line of code. jQuery has simplified it through easy selectors and functions. Employing jQuery helps us − Select elements efficiently. Handle events seamlessly. ... Read More

How to globally disable an animation using jQuery?

Alshifa Hasnain
Updated on 19-Feb-2025 17:51:17

923 Views

In this article, we will learn to globally disable an animation using jQuery. In jQuery, animations are commonly used to create smooth transitions and effects. However, there might be scenarios where you want to disable animations globally, such as improving performance on low-powered devices or creating an instant response for user interactions. Using jQuery.fx.off to Disable Animations To globally disable an animation using jQuery, use the jQuery.fx.off() method, which can be set to true to disable all animations and effects. When this property is enabled, jQuery methods like .animate(), .fadeIn(), .fadeOut(), and .slideToggle() execute instantly without any animation. To enable ... Read More

How to add easing effect to your animation with jQuery?

Ricky Barnes
Updated on 21-Jun-2020 13:14:24

586 Views

To add easing effect to your animation, use the animation speed properly to form it a perfect animation for the web page. Do not speed up animation and you should know where to stop it while using animate().Here for our example, we have a button that takes you to a textarea to add an answer:    Add answer Now set the fade out property properly to set easing effect.Example Live Demo               $(document).ready(function(){          $('body').on('click', '#answer', function() {             var container = $('.new-answer');   ... Read More

What is the difference between jQuery and JavaScript?

Kiran Kumar Panigrahi
Updated on 28-Jul-2022 16:07:56

2K+ Views

Both JavaScript and jQuery serve the same overarching objective of making the webpages more interactive and dynamic. They give the websites a sense of vibrancy. People may ask why there is a need for two distinct ideas if they serve the same function and are utilised in the same way. Read through this article to find out how jQuery differs from JavaScript.What is JavaScript?JavaScript is a lightweight programming language that is used most often as a component of webpages. Its webpage implementations enable client-side script to interact with the user and create dynamic sites. It is a programming language that ... Read More

How to handle bind an event using JavaScript?

Shubham Vora
Updated on 26-Aug-2022 13:35:20

10K+ Views

In this tutorial, we will learn how to handle bind an event using JavaScript. Events are the actions or occurrences in the system by the browser or users. There are various types of events that represent various activities performed by the browser or users. For example, if a user clicks on a button, it triggers an event named "click." Similarly, if a webpage finished loading, it triggered an event called "load." An Event Listener is a program that continuously listens to or waits for an event to occur. It is one of the most important parts of JavaScript. The ... Read More

Advertisements