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
jQuery Articles
Page 12 of 42
How to change the 'text-decoration' property with jQuery?
To change the text-decoration property with jQuery, use the jQuery css() method. This method allows you to dynamically modify CSS properties of HTML elements, including text decoration styles like underline, overline, line-through, or none. Syntax The basic syntax to change text-decoration property is − $(selector).css("text-decoration", "value"); Where value can be underline, overline, line-through, or none. Example You can try to run the following code to change text-decoration property from ...
Read MoreHow to make text bold, italic and underline using jQuery
To make text bold, italic and underline using jQuery, use the jQuery css() method with the CSS properties font-style, font-weight and text-decoration. The css() method allows you to dynamically modify CSS properties of HTML elements. Here are the key CSS properties used for text formatting − font-weight − Set to "bold" to make text bold font-style − Set to "italic" to make text italic text-decoration − Set to "underline" to underline text Example You can try to run the following code to ...
Read MoreHow can I change the font family and font size with jQuery?
To change the font family and font size with jQuery, use the jQuery css() method. The CSS properties font-family and font-size are used to modify the typography of elements dynamically. Basic Syntax The css()
Read MoreHow can I change the text color with jQuery?
To change the text color with jQuery, use the jQuery css() method. The color CSS property is used to change text color. Syntax The basic syntax for changing text color using jQuery is − $(selector).css("color", "color-value"); Where selector is the element you want to target and color-value can be a color name, hex code, RGB value, or any valid CSS color format. Example You can try to run the following code to learn how to change text color with jQuery − ...
Read MoreHow to return variable value from jQuery event function?
You cannot return variable value from jQuery event function. To understand the reason, let us see how data is passed, which was created in the event handler of a button click. The main issue is that event functions in jQuery are asynchronous, meaning they execute after the main code flow has completed. When you try to return a value from an event handler, there's nothing to receive that return value since the calling function has already finished executing. Understanding the Problem Event handlers work differently from regular functions because they are callback functions that get executed when ...
Read MoreHow to bind jQuery events within dynamic content returned via Ajax?
To bind jQuery events within dynamic content, use event delegation. Event delegation allows you to attach events to elements that don't exist yet in the DOM, which is essential when working with content loaded dynamically via Ajax. The key is to bind events to a parent element that already exists (like document) and specify the target selector as the second parameter. This way, when new elements are added dynamically, they will automatically respond to the events. Event Delegation Syntax Use the following syntax for event delegation − $(document).on('event', 'selector', function() { ...
Read MoreHow to handle when checkbox 'checked state' changed event in jQuery?
To handle the checkbox checked state, use the change event. It will check whether the checkbox is checked or not. The change event is triggered whenever the state of a checkbox changes from checked to unchecked or vice versa. You can use different jQuery methods to detect the checked state: .prop("checked") − Returns true/false (recommended method) .is(":checked") − Returns true/false .attr("checked") − Returns the attribute value Example You can try to run the following code to learn how to handle when checkbox checked state changed ...
Read MoreCan I wrap a JavaScript event in a jQuery event?
Yes, you can wrap a JavaScript event in a jQuery event. For wrapping, use the jQuery event object and the $.Event() constructor. This allows you to create a jQuery event wrapper around a native JavaScript event, giving you access to jQuery's event handling methods and properties. Example You can try to run the following code to wrap a JavaScript event in a jQuery event − $(document).ready(function(){ ...
Read MoreHow to disable copy content function using jQuery?
To disable cut, copy and paste of a content in jQuery, use the jQuery bind() function. This method allows you to bind event handlers to specific events and prevent their default behavior using preventDefault(). Example You can try to run the following code to disable copy paste of content using jQuery − $(document).ready(function(){ $('#mytext').bind("cut copy paste", function(e) { ...
Read MoreHow to pass a jQuery event as a parameter in a method?
To pass a jQuery event as a parameter in a method, you can use the bind() method or modern event handling methods like on(). The event object contains useful information about the triggered event and can also carry custom data through the event.data property. Example You can try to run the following code to learn how to pass a jQuery event as a parameter − $(document).ready(function(){ ...
Read More