Found 633 Articles for JQuery

How to check input file is empty or not using JavaScript/jQuery?

Rushi Javiya
Updated on 10-Mar-2023 16:52:40
In JavaScript, while working with the form elements, we need to validate the input fields and form elements when a user enters the value. In this tutorial, we will work with the file input. We will also learn to validate the file input. Sometimes, we may be required to check if the file is selected in the input field, then only enable the submit button; otherwise, disable the submit button. So, it will not allow users to submit the form or file without selecting it. Validate the file input using JavaScript In JavaScript, we can access the file input ... Read More

How to use jQuery touch events plugin for mobiles?

Rushi Javiya
Updated on 07-Mar-2023 13:47:30
JavaScript and jQuery contain various plugins, and every plugin contains a couple of functions. JavaScript plugin works as a library, and we can use its code directly in our code. The jQuery touch event plugin is also a library used to detect touch events in mobile devices and execute some functions when a touch event occurs. Using the CDN, we can add the jQuery touch event plugin to the HTML. If users are working with the Node application, they should execute the below command in the project directory to add the jQuery touch events plugin to the application. ... Read More

How to use input readonly attribute in jQuery?

Rushi Javiya
Updated on 07-Mar-2023 11:45:12
The readonly is an HTML attribute that we can add to any HTML tag. Whenever we use the readonly attribute with any HTML element, it becomes non-editable. Users can’t write into the text field but can only read. In this tutorial, we will learn to add the readonly attribute to the HTML element using the various methods of jQuery. Use the attr() method of jQuery The attr() method of jQuery sets the attribute to the HTML element. It takes two parameters, and we can pass the attribute name as the first parameter and the attribute value as the second ... Read More

How to check an element exist or not in jQuery?

Aman Gupta
Updated on 27-Feb-2023 16:14:52
Overview We can check for an HTML element such as , , etc that they exist in the HTML page or not using jQuery. To achieve the solution, we have the "length" property of jQuery, which checks the specific element in the HTML document and returns the length of the particular element, which is the number of times that element is present in the HTML body. The length property is present in the jQuery ($) main library. Syntax The syntax used in this program is − $(elementName).length; elementName −The elementName can be any tag, class name, id name ... Read More

How to check an array is empty or not using jQuery?

Aman Gupta
Updated on 27-Feb-2023 16:16:34
Overview In jQuery, we can easily check whether an array is empty or not by using multiple methods. The collective way includes length property and as in JavaScript arrays are the object so using the jQuery alias symbol $.isEmptyObject(objName). An array is a collection of elements. So to achieve our goal, we should have some prior knowledge about the syntax of jQuery and how to manipulate the HTML. It is necessary to write the “$” with isEmptyObject() method as “$” is the main library of the jQuery which contains various method as isEmptyObject(), isArray(), isFunction() and many more. In all ... Read More

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

Gungi Mahesh
Updated on 24-Feb-2023 13:25:28
The scrollTop property of HTML DOM elements is used to set or return the number of pixels of an elements content which is scrolled vertically. Suppose if the scroll bar is not generated by the content elements then the value of the scrollTop is zero. The onclick event occurs only when a user clicks the elements and it is a purely JavaScript attribute. Whenever you click on the onclick event it does some actions like displaying a message or redirects the user another page. The onclick event must be used very less in the website, because it may create the ... Read More

How to eliminate close button from jQuery UI dialog box using CSS?

Riya Kumari
Updated on 22-Feb-2023 15:35:31
Displaying data in a sorted manner within a HTML web page is a cumbersome task. The dialog boxes are used to display information in a presentable manner in a web page. A dialog box is a floatable window which contains a header and the content. jQuery UI enables the developers to create simple and user-friendly dialog boxes for the website. In this article, we will discuss about how to create jQuery UI dialog boxes as well as how to eliminate the close button from those boxes. First, let’s understand about jQuery UI dialog boxes. jQuery UI Dialog Box The ... Read More

How to apply CSS style using jQuery?

Dishebh Bhayana
Updated on 22-Feb-2023 10:51:25
We can use jquery’s .css() method to apply CSS style on the given webpage. jQuery is a javascript library that helps us manipulate the DOM easily and efficiently using its various helper methods and properties. It allows us to add interactivity to the DOM as well as add and change the CSS styles of the DOM elements. Syntax $(selector).css(property, value) OR $(selector).css({ property: value, property: value, … }) JQuery css() method accepts either an argument of type object, with key as the CSS property name and value as the desired property value to be set to, or ... Read More

How to copy the content of a div into another div using jQuery?

Saurabh Anand
Updated on 21-Feb-2023 17:16:52
We can use jQuery html() method to copy the content of a div into another div. In jQuery, many other methods, such as clone(), append() & appendTo(), etc., can be used to copy the content. jQuery is a JavaScript library designed to simplify HTML DOM tree traversal and manipulation, as well as event handling, CSS animation, and Ajax. In this tutorial, we will use different methods in jQuery to copy the content of one div into another div. Using the html() Method Using the jQuery html() function is the simplest approach to copy the content of a div into ... Read More

How to Build a Simple Terminal like Website using jQuery?

Updated on 16-Feb-2023 11:50:18
We will start by creating a basic HTML structure for our website. Next, we will use jQuery to create a terminal-like interface by adding elements such as input fields and output displays. Finally, we will use jQuery functions to handle user input and display the appropriate response. Let us first understand what jQuery is. jQuery is a JavaScript library that simplifies HTML document traversing, event handling, and animation. It allows for easy manipulation of the Document Object Model (DOM). It also provides several shorthand methods for common JavaScript tasks, such as making AJAX requests. It is widely used in web ... Read More
1 2 3 4 5 ... 64 Next