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 by Ricky Barnes
Page 5 of 9
How can I know which radio button is selected via jQuery?
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 MoreHow do I check if an element is hidden in jQuery?
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 MoreHow to select element with specific class and title attribute using jQuery?
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 MoreHow to use a variable in a string in jQuery?
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 MoreHow to write a custom jQuery plugin?
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 Morebg-light class for Bootstrap 4 cards
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 MoreHow can I bind all events on a DOM element using jQuery?
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 MoreWhat is an Event Object in jQuery?
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 Moreborder-top-0 class in Bootstrap 4
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 MoreSet orange border on an element in Bootstrap to indicate danger
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