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 disable/ enable checkbox with jQuery?
To disable and enable checkboxes, use the attr() method or prop() method in jQuery. The disabled attribute prevents users from interacting with the checkbox, making it unclickable and visually grayed out. Using the attr() Method Initially set the input type checkbox and disable it − Male Now on the click of a button, toggle between disabled and enabled checkbox − $("#button1").click(function() { $("#sName").attr('disabled', !$("#sName").attr('disabled')); }); Example The following example demonstrates how to toggle checkbox state using the attr() approach rewritten in vanilla JavaScript (since jQuery CDN is not available in the ...
Read MoreHow to make a textarea and input type read only using jQuery?
To make a textarea and input type read only, use the attr() method or the prop() method in jQuery. The readonly attribute prevents users from editing the content while still allowing the elements to be focused and their values to be submitted with the form. Using the attr() Method The attr() method sets HTML attributes on selected elements. To make input fields and textareas read only, set the readonly attribute − $('input[type="text"], textarea').each(function() { $(this).attr('readonly', 'readonly'); }); Example The following example uses the attr() method to set readonly on a text input and textarea ...
Read MoreHow can I show and hide div on mouse click using jQuery?
To show and hide div on mouse click using jQuery, use the toggle() method. On mouse click, the div is visible and on again clicking the div, it hides. The toggle() method is a convenient jQuery function that automatically switches between showing and hiding elements. When an element is visible, toggle() will hide it, and when it's hidden, toggle() will show it. Example Here's a complete example that demonstrates how to show and hide a div on mouse click − ...
Read MoreSorting an already sorted internal table in ABAP
When working with internal tables in ABAP, sorting performance can be optimized by understanding how sorting affects subsequent operations. If you leave the second sort operation, it would be quicker as the internal table (itab) will already be in the right order. Sorting and Binary Search Example Consider the following example where we sort by multiple fields and then perform binary searches − SORT itab BY f1 f2 f3. READ TABLE itab WITH KEY f1 = 'A' f2 = 'B' ...
Read MoreMoving TABKEY from CDPOS table into field structure in ABAP
When working with change documents in ABAP, you may need to move the TABKEY from the CDPOS table into a field structure. I would suggest you make use of Function Module CHANGEDOCU_KEY_ANY2CHAR and other function modules of function group SCD8. This function module performs the reverse function of converting change document keys. Using CHANGEDOCU_KEY_ANY2CHAR Function Module The primary function module for this task has the following details − Function Module: CHANGEDOCU_KEY_ANY2CHAR Function Group: SCD8 ...
Read MoreHow can I make jQuery animations smoother?
To make jQuery animations smoother, use the easing library and set appropriate animation speeds to create perfect animations for your web page. Avoid speeding up animations excessively and know when to stop them while using animate(). The easing library provides various transition effects like swing, linear, easeIn, and easeOut that make animations appear more natural and polished. Key Tips for Smoother Animations Here are essential techniques to improve jQuery animation quality − Use proper timing: Choose appropriate duration values (fast, slow, or milliseconds) Chain animations: Link multiple ...
Read MoreHow to animate a change in background color using jQuery on mouseover?
To change background color with animation, use the mouseenter and mouseleave events. The background color changes smoothly when you place the mouse cursor over an element using jQuery's animate() method. For basic color change without animation, you can use the css() method − mouseenter: function(){ $(this).css("background-color", "gray"); } However, to create smooth animated transitions, jQuery's animate() method provides better visual effects. The mouse cursor interaction is applied to the following element − Move the mouse pointer to animate the background color change. Example You can try ...
Read MoreHow animate(), hide and show elements using jQuery?
jQuery provides powerful methods to animate, hide and show elements with smooth visual effects. You can use the animate() method combined with hide() and show() methods to create dynamic animations that enhance user experience. animate() Method The animate() method allows you to create custom animations by gradually changing CSS properties. When combined with hide() and show() methods as callback functions, you can create smooth transition effects. Syntax $(selector).animate({properties}, speed, callback); Example Here's a complete example showing how to animate elements before hiding and showing them − ...
Read MoreWhat is the difference between jQuery.size() and jQuery.length?
jQuery.size() method returns the number of elements in the jQuery object. The size() method was deprecated in jQuery 1.8 and completely removed in jQuery 3.0. As an alternative, the length property is used. Example You can try to run the following code to learn how to work with size() method − Note: To run the jQuery size() method, use jQuery version less than 1.8, since it was deprecated in jQuery 1.8. Generally, the length property is preferred now. ...
Read MoreHow to add display:none in an HTML element using jQuery?
To work with display: none in an HTML element using jQuery, you can use the hide() method. This method applies the CSS property display: none to the selected elements, effectively hiding them from view. The jQuery hide() method is a convenient way to hide elements without manually setting CSS properties. It's part of jQuery's animation and effects methods. Example You can try to run the following code to learn how to add display:none in an HTML element − ...
Read More