jQuery Articles

Page 2 of 42

How to Check a String Starts/Ends with a Specific String in jQuery?

Ayushya Saxena
Ayushya Saxena
Updated on 15-Mar-2026 965 Views

JavaScript provides several built-in methods to check if a string starts or ends with specific characters. While jQuery is excellent for DOM manipulation, these string operations are handled by native JavaScript methods that work efficiently without any additional library. In this article, we'll explore various approaches to verify if a string begins or ends with another string using practical examples. Using startsWith() Method The startsWith() method is the most direct way to check if a string begins with specific characters. It's case-sensitive and returns a boolean value. Syntax str.startsWith(searchString, position) Parameters ...

Read More

How to Change an HTML Element Name Using jQuery?

Aayush Mohan Sinha
Aayush Mohan Sinha
Updated on 15-Mar-2026 1K+ Views

jQuery is a JavaScript library created to make event handling, CSS animation, Ajax, and DOM tree navigation and manipulation easier. In this article we are going to see how we can change the name of an element using jQuery. Algorithm We are going to follow a three−way procedure to change the name of any element using jQuery: Identify and select the element we want to change. Copy all the attributes of the selected element to a temporary object. Create a new element with the ...

Read More

How to set textarea scroll bar to bottom as a default using JavaScript/jQuery?

Gungi Mahesh
Gungi Mahesh
Updated on 15-Mar-2026 3K+ Views

In JavaScript, you can set a textarea's scroll bar to the bottom using the scrollTop property. This is useful when you want to automatically show the most recent content, such as in chat applications or log displays. Syntax element.scrollTop = element.scrollHeight; Parameters scrollHeight − Returns the total height of the element's content, including content not visible due to overflow. Method 1: Using Pure JavaScript This approach uses the DOM's scrollTop property to position the scroll bar at the bottom of the textarea. ...

Read More

How to check two elements are the same using jQuery/JavaScript?

Rushi Javiya
Rushi Javiya
Updated on 15-Mar-2026 2K+ Views

We can access HTML elements using various methods in vanilla JavaScript or jQuery. Sometimes, after accessing DOM elements, developers need to check if both accessed elements are the same or not. In this tutorial, we will learn to use JavaScript's strict equality operator and jQuery's is() method to check the equality of two HTML elements. Using the Equality Operator (===) in JavaScript We can access HTML elements using methods like getElementById, querySelector, getElementsByClassName, etc. After storing elements in JavaScript variables, we can compare them using the strict equality operator (===). Syntax if (element1 === element2) ...

Read More

Use jQuery to get values of selected checkboxes?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 505 Views

jQuery provides an efficient way to get values of selected checkboxes using the :checked selector combined with checkbox input elements. This is useful for forms where users can select multiple options. Syntax $('input[type="checkbox"]:checked') // or $('input[name="checkboxName"]:checked') Basic Example Here's a complete example that demonstrates getting values of selected checkboxes: jQuery Checkbox Values Select your hobbies: ...

Read More

How to add content in section using jQuery/JavaScript?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 2K+ Views

Adding content to the section dynamically is useful for loading CSS, JavaScript, or meta tags after page load. jQuery and JavaScript provide several methods to accomplish this task programmatically. There are three main approaches to add content to the head section: Using jQuery's .append() method Using JavaScript's document.createElement() method Using JavaScript's insertAdjacentHTML() method Let's explore each approach with working examples. Using jQuery's .append() Method jQuery's append() method provides a simple way to add content to the head section: ...

Read More

Add sizes for Bootstrap Buttons

Arjun Thakur
Arjun Thakur
Updated on 15-Mar-2026 316 Views

Bootstrap provides several CSS classes to control button sizes, from large buttons to block-level buttons that span the full width of their container. Button Size Classes Class Description .btn-lg ...

Read More

How to fire after pressing ENTER in text input with HTML?

Vrundesha Joshi
Vrundesha Joshi
Updated on 15-Mar-2026 530 Views

There are several ways to detect when the ENTER key is pressed in a text input field. Here are the most common and effective approaches. Using jQuery with Custom Event This approach creates a custom "enterKey" event that triggers when ENTER is pressed: $(document).ready(function(){ $('input').bind("enterKey", function(e){ ...

Read More

img-rounded Bootstrap class

George John
George John
Updated on 15-Mar-2026 346 Views

Use the img-rounded Bootstrap class to style your image and give it rounded corners. This class applies CSS border-radius to create smooth, rounded edges on images. Syntax Example Bootstrap Images Styling Images with Bootstrap ...

Read More

Move an HTML div in a curved path

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 15-Mar-2026 430 Views

To move an HTML div in a curved path, you can use CSS animations, JavaScript, or HTML5 Canvas. JavaScript provides the most flexibility and browser compatibility for complex curved animations. CSS Transitions - Simple curved paths using cubic-bezier JavaScript (jQuery) - Custom curved animations with precise control HTML5 Canvas - Complex curved paths with mathematical precision We'll focus on JavaScript solutions using jQuery's animate() method and modern CSS transforms. jQuery animate() Method The animate() method performs custom animations by changing CSS properties over time. ...

Read More
Showing 11–20 of 413 articles
« Prev 1 2 3 4 5 42 Next »
Advertisements