jQuery Articles

Page 7 of 42

How to change the background image using jQuery?

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

To change the background image using jQuery, use the jQuery css() method. The background-image CSS property is used to change background image. Syntax The basic syntax to change background image using jQuery is − $(selector).css("background-image", "url('path/to/image.jpg')"); Example You can try to run the following code to learn how to change background image using jQuery − body { height: ...

Read More

How to disable a particular jQuery event on a page?

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

To disable a particular jQuery event, use the jQuery off() method. The off() method removes event handlers that were attached with the on() method. This is particularly useful when you need to dynamically control event behavior based on user interactions or application state. Syntax The basic syntax for the off() method is − $(selector).off(event, selector, function) Where: event − Specifies the event type to remove (e.g., "click", "mouseover") selector − Optional. Specifies which event handler to remove for delegated events function ...

Read More

How to change the background color using jQuery?

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

To change the background color using jQuery, use the jQuery css() property. We will change background color on mouse hover with the jQuery on() and css() method. Understanding jQuery css() Method The css() method in jQuery allows you to get or set CSS properties of selected elements. To change background color, you can use css("background-color", "colorvalue") where colorvalue can be a color name, hex code, or RGB value. Example You can try to run the following code to learn how to change background color using jQuery − ...

Read More

How to underline a Hyperlink on Hover using jQuery?

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

To underline a hyperlink on hover using jQuery, use the jQuery css() method. The text-decoration property is used to control the underlining effect. The hover() method in jQuery allows you to specify functions that execute when the mouse enters and leaves an element. You can use this method along with css() to dynamically change the text decoration of hyperlinks. Example You can try to run the following code to learn how to underline a hyperlink on hover − jQuery Hyperlink Decoration ...

Read More

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

Amit D
Amit D
Updated on 13-Mar-2026 862 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 814 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
Showing 61–70 of 413 articles
« Prev 1 5 6 7 8 9 42 Next »
Advertisements