Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles on Trending Technologies
Technical articles with clear explanations and examples
How to check which key has been pressed using jQuery?
To check which key has been pressed in jQuery, you can use the keydown, keyup, or keypress event handlers. The most common approach is to use the keydown event, which fires when a key is pressed down. Using jQuery Event Handlers jQuery provides several methods to detect key presses. You can bind event listeners to elements and capture the key information from the event object. The event.key property returns the value of the key pressed. Example You can try ...
Read MoreHow to prevent the browser from executing the default action in jQuery?
To prevent the browser from executing the default action in jQuery, use the preventDefault() method. The preventDefault() method prevents the browser from executing the default action associated with an event, such as following a link, submitting a form, or checking a checkbox. Example The following example demonstrates how to prevent a link from navigating to its href destination. You can also use the method isDefaultPrevented() to know whether this method was ever called on that event object − jQuery preventDefault() ...
Read MoreHow to get attribute of an element when using the 'click' event in jQuery?
To get attribute of an element, use the attr() method in jQuery. The attr() method retrieves the value of an attribute from the first element in the matched set of elements. When used with click events, it allows you to dynamically access element attributes when user interactions occur. Example You can try to run the following code to get attribute of an element using the 'click' event − $(document).ready(function(){ $("button").click(function(){ ...
Read MoreHow to check the element type of an event target with jQuery?
To check the element type of an event target, we use the is() method. The is() method checks the current matched set of elements against a selector and returns true if at least one of these elements matches the given arguments. Example You can try to run the following code to check the element type − $(document).ready(function(){ $("ul").click(function(event) { ...
Read MoreHow to handle a mouse right click event using jQuery?
To handle a mouse right click event, use the mousedown() jQuery method. Mouse left, right and middle click can also be captured using the same method. The event.which property helps identify which mouse button was clicked: 1 for left, 2 for middle, and 3 for right mouse button. Example You can try to run the following code to learn how to handle a mouse right click event − $(document).ready(function(){ ...
Read MoreHow to handle a double click event using jQuery?
To handle a double click event using jQuery, use the dblclick() event. When an element is double clicked, this event occurs. The dblclick() method triggers the double-click event or attaches a function to run when a double-click event occurs on the selected elements. Syntax The basic syntax for the dblclick() method is − $(selector).dblclick(function) Where function is optional and specifies the function to run when the double-click event occurs. Example You can try to run the following code to learn how to handle double click event using jQuery − ...
Read MoreHow to handle a link click event using jQuery?
To handle a click event using jQuery, use the click() method. This method allows you to attach a function that executes when a user clicks on a link or any other element. You can try to run the following code to handle a link click event using jQuery − Example Here's a complete example that demonstrates handling link click events − $(document).ready(function(){ $("a").click(function(){ ...
Read MoreHow can I remove everything inside of a using jQuery?
To remove everything inside a div element, you can use jQuery's empty() method or remove() method. The empty() method removes all child elements while keeping the div itself, whereas remove() removes the entire div element including its contents. Using empty() Method The empty() method is the most appropriate choice when you want to clear the contents inside a div while preserving the div element itself − $(document).ready(function(){ ...
Read MoreHow can I remove all elements except the first one using jQuery?
To remove all elements except the first one, use the remove() method with the slice() method in jQuery. The slice(1) method selects all elements starting from index 1 (the second element), leaving the first element untouched. Example You can try to run the following code to remove all elements except for first one using jQuery − $(document).ready(function(){ $(".button1").click(function(){ ...
Read MoreFinding the table from which data is fetched in SAP
You can get the data if it is displayed in a transaction. Here are the steps you need to follow to find the table from which data is fetched in SAP. Method 1: Using F1 Help and Technical Information This is the most straightforward method to identify the source table for any field displayed in SAP − First, point the cursor on the field for which you want to get the data Press F1 for help. This will open a ...
Read More