Ricky Barnes

Ricky Barnes

84 Articles Published

Articles by Ricky Barnes

Page 5 of 9

How can I know which radio button is selected via jQuery?

Ricky Barnes
Ricky Barnes
Updated on 13-Mar-2026 321 Views

Use the jQuery val() method to get the value of the selected radio button. The :checked selector in combination with input:radio helps identify which radio button is currently selected in a group. Example You can try to run the following code to learn how to know which radio button is selected via jQuery − jQuery Selector ...

Read More

How do I check if an element is hidden in jQuery?

Ricky Barnes
Ricky Barnes
Updated on 13-Mar-2026 295 Views

Using jQuery, you can detect if a specific element in the page is hidden or visible with :visible and :hidden selectors. jQuery provides several methods to check element visibility, with is(':visible') and is(':hidden') being the most commonly used approaches. Methods to Check Element Visibility There are two primary selectors you can use − :visible − Selects elements that are visible (display is not 'none', visibility is not 'hidden', and opacity is not 0) :hidden − Selects ...

Read More

How to select element with specific class and title attribute using jQuery?

Ricky Barnes
Ricky Barnes
Updated on 13-Mar-2026 2K+ Views

If your element is having a class and title attribute, you can select it with jQuery using attribute selectors combined with class selectors. The syntax combines the class selector (dot notation) with the attribute selector in square brackets. You can try to run the following code to learn how to select element with specific class and 'title' attribute using jQuery. Syntax The basic syntax for selecting elements with both class and title attribute is − $(".className[title='titleValue']") Example Here's a complete example that demonstrates how to select and style elements with specific class and ...

Read More

How to use a variable in a string in jQuery?

Ricky Barnes
Ricky Barnes
Updated on 13-Mar-2026 4K+ Views

jQuery is a JavaScript library introduced to make development with JavaScript easier. Let us see how to use a variable in a string using jQuery methods like html() and template literals. Using String Concatenation The most common way to use variables in strings is through string concatenation using the + operator. This allows you to combine static text with dynamic variable values. Example You can try to run the following code to learn how to use variable in a ...

Read More

How to write a custom jQuery plugin?

Ricky Barnes
Ricky Barnes
Updated on 13-Mar-2026 347 Views

To create a jQuery plugin, first create a file named jquery-demoplugin.js with the following code. This is our plugin code. Here, demoplugin is the name of our plugin. You can add any name to your custom plugin − (function ( $ ) { $.fn.demoplugin = function( options ) { var web = $.extend({ name: 'example' }, options ); ...

Read More

bg-light class for Bootstrap 4 cards

Ricky Barnes
Ricky Barnes
Updated on 11-Mar-2026 489 Views

To set a light grey background for the Bootstrap 4 cards, use the bg-light class.Use “card bg-light” like any other class in Bootstrap −   Image Editor The above gives a light grey background to the Bootstrap card.Let us see an example of the card-light class −Example       Bootstrap Example                             Web Tools           Image Editor             Image Optimizer      

Read More

How can I bind all events on a DOM element using jQuery?

Ricky Barnes
Ricky Barnes
Updated on 11-Mar-2026 775 Views

The bind( type, [data], fn ) method binds a handler to one or more events (like click) for each matched element. It can also bind custom events.Possible event values − blur, focus, load, resize, scroll, unload, click etc.Here is the description of all the parameters used by this method −type − One or more event types separated by a space.data − This is optional parameter and represents additional data passed to the event handler as event.data.fn − A function to bind to the event on each of the set of matched elements.ExampleYou can try to run the following code to learn how to ...

Read More

What is an Event Object in jQuery?

Ricky Barnes
Ricky Barnes
Updated on 11-Mar-2026 531 Views

The callback function takes a single parameter; when the handler is called the JavaScript event object will be passed through it.The event object is often unnecessary and the parameter is omitted, as sufficient context is usually available when the handler is bound to know exactly what needs to be done when the handler is triggered, however there are certain attributes which you would need to be accessed.Let us see an example of isDefaultPrevented() method. The isDefaultPrevented() method checks whether event.preventDefault() was ever called on this event object.ExampleYou can try to run the following code to learn how to work with ...

Read More

border-top-0 class in Bootstrap 4

Ricky Barnes
Ricky Barnes
Updated on 11-Mar-2026 365 Views

Use the border-top-0 class in Bootstrap 4 to remove the top border.Set the border-top-0 class −   Rectangle is missing the TOP border. Let us see an example to implement the border-top-0 class −Example       Bootstrap Example                             .mystyle {       width: 350px;       height: 170px;       margin: 10px;     }             Heading Two           Rectangle is missing the TOP border.      

Read More

Set orange border on an element in Bootstrap to indicate danger

Ricky Barnes
Ricky Barnes
Updated on 11-Mar-2026 257 Views

To set orange border to an element, use the border-warning class −   Danger (Orange border) Set the style for the element − .mystyle {   width: 200px;   height: 100px;   margin: 10px; } Let us see an example to implement the border-warning class in Bootstrap −Example       Bootstrap Example                             .mystyle {       width: 200px;       height: 100px;       margin: 10px;     }             The following are two Rectangles:     Danger (Orange border)  

Read More
Showing 41–50 of 84 articles
« Prev 1 3 4 5 6 7 9 Next »
Advertisements