jQuery Articles

Page 12 of 42

How to change the 'text-decoration' property with jQuery?

Amit D
Amit D
Updated on 13-Mar-2026 874 Views

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 More

How to make text bold, italic and underline using jQuery

Amit D
Amit D
Updated on 13-Mar-2026 4K+ Views

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 More

How can I change the font family and font size with jQuery?

Amit D
Amit D
Updated on 13-Mar-2026 2K+ Views

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 More

How can I change the text color with jQuery?

Amit D
Amit D
Updated on 13-Mar-2026 13K+ Views

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 More

How to return variable value from jQuery event function?

Amit D
Amit D
Updated on 13-Mar-2026 3K+ Views

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 More

How to bind jQuery events within dynamic content returned via Ajax?

Alex Onsman
Alex Onsman
Updated on 13-Mar-2026 818 Views

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 More

How to handle when checkbox 'checked state' changed event in jQuery?

Alex Onsman
Alex Onsman
Updated on 13-Mar-2026 3K+ Views

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 More

Can I wrap a JavaScript event in a jQuery event?

Alex Onsman
Alex Onsman
Updated on 13-Mar-2026 337 Views

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 More

How to disable copy content function using jQuery?

Alex Onsman
Alex Onsman
Updated on 13-Mar-2026 2K+ Views

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 More

How to pass a jQuery event as a parameter in a method?

Alex Onsman
Alex Onsman
Updated on 13-Mar-2026 3K+ Views

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
Showing 111–120 of 413 articles
« Prev 1 10 11 12 13 14 42 Next »
Advertisements