Practical solutions

jQuery Howtos How-To Guides

Solve the problem. Keep building. Collection of jQuery how-to articles

Find the answer you need

Browse practical solutions, grouped by the task you're working on.

__COUNT__ entries on this page

How to Capitalize First Letter in jQueryThis tutorial demonstrates how to capitalize the first letter of string using jQuery. How to Clear Form Fields With jQueryTo clear form fields using jQuery, you can set their values to an empty string. This article teaches you two ways that you can use. The first considers checkboxes while the second does not. How to Scroll to the Top of a Page in JavaScriptWe show several methods to scroll to the top of the page using JavaScript in this blog post. We use both vanilla JavaScript and jQuery. You will also see a clever plain HTML hack to scroll to the top JavaScript and a small script to design a custom JavaScript scroll to the top animation from scratch. How to Disable Button in jQueryWe use the onclick event handler and pass the event object, the this keyword, and the element id to disable button in jQuery. You will also see the use of the HTML disabled attribute and the disabled DOM property. How to Get Selected Option From Dropdown in jQueryIn this article, we'll discuss different methods to jQuery get selected option from dropdowns. We cover multiple-option select elements and grouped option select elements. How to Pass Request Headers in jQuery AJAXThis tutorial demonstrates how to use headers in jQuery AJAX. How to Create Elements in jQueryThis tutorial demonstrates how to create an HTML element in jQuery. How to Create an Alert Using jQueryThis article demonstrates how to create an alert using jQuery. How to Use the NPM jQuery ModuleThis tutorial demonstrates how to install and use the npm jQuery module. How to Use the for Loop in jQueryThis tutorial demonstrates how to use the for loop in jQuery. How to Scroll to Element in jQueryWe use scrollTop() and offset() functions to scroll to element in this post. We show different ways and useful options for every use case. Also, we provide two shortcuts and few tips you need to take care of. You will also learn to animate scroll in jQuery. How to Replace Text and DOM Elements in jQueryThis tutorial demonstrates how to replace the text and DOM elements in jQuery. How to Display a Tooltip Message on Hover Using jQueryThis tutorial demonstrates how to use the Tooltip in jQuery-UI to display a tooltip message on hover using jQuery. How to Remove Class in jQueryThis tutorial demonstrates how to remove class names in jQuery. How to Check if an Element Exists Using jQueryThis tutorial demonstrates how to check if an element exists using jQuery. jQuery Confirm PluginThe jQuery confirm is a plug-in that ensures multipurpose facilities including the functions of alert, dialog, and confirm. Also, it allows updated UI, themes, and many more conventions. How to Get Height in jQueryIn today's post, we'll learn about getheight method in jQuery. How to Trigger the Same Function From Multiple Events in jQueryThis article teaches you how to trigger the same function from multiple events in jQuery. We'll show two examples that show you how to do this using a jQuery API. The first example tracks user movements in HTML form inputs. While the second will change an HTML element background color. How to Submit Form With AJAX in jQueryThis article teaches you three methods that will submit a form using AJAX-in-jQuery. The first is direct use of AJAX-in-jQuery while the second employs the AJAX Form Plugin. In the third method, we use the FormData object to grab the form data before sending it using AJAX. How to Set Value of Text Area in jQueryThis tutorial demonstrates the use of .val() and .attr() methods to set the value of text area in JQuery. How to Empty Input Field With JQueryThis tutorial demonstrates the use of .val() function to clear an input field in JQuery. How to Get Form Data Using JQueryThis article uses serialize() and serializeArray() method to get form data using JQuery. It also demonstrates how to get form data in an object form. How to Upload File AJAX in jQueryjQuery methods and conventions enhances the upload of files. In this regard, the AJAX (Asynchronous JavaScript And XML) will help to read data from a web server, update the webpage without reload, also post data to web server. How to Add ID to an HTML Element Using jQueryID uniquely represents an HTML element. To dynamically define the id for an element via jQuery, the .attr() method having the attribute id and value will work perfectly. But there can be another way to add an id to an element through jQuery: to use the .add() method.