Found 637 Articles for JQuery

How to Add Edit and Delete Table Row in jQuery?

Aayush Mohan Sinha
Updated on 28-Mar-2023 15:54:44
In this modern age of web development, effective and efficient management of tables has become important, peculiarly when dealing with data-heavy web applications. The ability to dynamically add, edit, and delete rows from a table can significantly enhance the user experience and make the application more interactive. One effective approach to achieve this is by utilizing the prowess of jQuery. jQuery provides a number of functionalities to help the developer to perform the actions. Table Row A table row, collection of inter-related data, is represented by the element in HTML. It is used to group cells (represented by the ... Read More

How to check the current selection against an expression using jQuery?

Vidushi Tomar
Updated on 24-Mar-2023 13:43:00
Overview jQuery is a fast, small, and feature-rich JavaScript library. It helps in DOM manipulation, event handling, animation, CSS and Ajax. To achieve the requirement we’ll use the “is(selector)” method of jQuery. is(selector) This method checks the currently selected elements against an expression/selector and returns true if any one of the selected elements matches with the selector. In the below code, we have created a container with the class “test”. We want to change the background color of the container when it is clicked. So, “test” which is the class name of the container will be used as a selector ... Read More

How to count every element including the head and body in the document in jQuery?

Aman Gupta
Updated on 24-Mar-2023 12:26:01
Overview To count each and every element in the HTML document including the head tag and body tag can be achieved using the jQuery "length()" method. By selecting the universal selector ( * ) as selector and calculating the length of its using length property will return the number of the elements contained in the HTML document page. Syntax The syntax used to count the number of elements is − $(“*”).property; selector − The selector used in this is the universal selector, as the name itself describes that it selects each and every element of the page. ... Read More

How to Convert a HTML Table into Excel Spreadsheet using jQuery?

Aman Gupta
Updated on 24-Mar-2023 12:14:21
Overview To convert the HTML Table into the Excel Spreadsheet can be done with the help of jQuery plugins. The “table2excel” is a lightweight plug-in of jQuery, which helps to achieve the solution to the problem. In this we will create a table using HTML tag in that we will create the number of rows using tag. The data is inserted inside the rows using the tag. Syntax The syntax used in this is − $(selector).table2excel({ filename: “”, fileext: “” }); selector − It can be any HTML ... Read More

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
1 2 3 4 5 ... 64 Next