Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • GfG 160: Daily DSA
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • jQuery Tutorial
  • jQuery Selectors
  • jQuery Events
  • jQuery Effects
  • jQuery Traversing
  • jQuery HTML & CSS
  • jQuery AJAX
  • jQuery Properties
  • jQuery Examples
  • jQuery Interview Questions
  • jQuery Plugins
  • jQuery Cheat Sheet
  • jQuery UI
  • jQuery Mobile
  • jQWidgets
  • Easy UI
  • Web Technology
Open In App
Next Article:
jQuery HTML/CSS Methods Complete Reference
Next article icon

jQuery HTML/CSS Methods Complete Reference

Last Updated : 05 May, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

JQuery provides methods to control the DOM inefficient way.  JQuery provides methods that act as getter, retrieving information from DOM elements like .attr(), .html(), and .val().

All the selectors included in CSS are supported in jQuery. jQuery CSS Methods are used to apply CSS properties on DOM elements.

Syntax:

$(selector).method(attribute.., function..)

Example: Set text syntax

HTML

<html>

<body>
    <h1>
    <center>
    Geeks <button onclick="function()">Click me
        button>
    center>
h1>

    <script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
script>
    <script>
        $(document).ready(function() {
            $("button").click(function() {
                $("p").text("Jquery_text_method");
            });
        });
    script>

    <p>GeeksforGeeksp>
    <p>Jqueryp>

body>

html>

Output:

The complete list of jQuery HTML/CSS Methods is given below:

Methods:

HTML/CSS Methods 

Description

addClass()Add more properties to each selected element.
after()Insert content, specified by the parameter for each selected element in the set of matched elements. 
append()Insert some content at the end of the selected elements. 
appendTo()Insert an HTML element at the end of the selected element. 
attr()Return the attributes and values of the selected elements. 
before()Add the content before the selected element. 
clone()Make a copy of selected elements including their child nodes, text, and attributes.
css()Change the style property of the selected element.
detach()It removes the selected elements from the DOM tree including its all text and child nodes
empty()Remove all child nodes and their content for the selected elements.
hasClass()Check whether the elements with the specified class name exist or not.
height()Check the height of an element. 
innerHeight()Check the inner height of the element including padding.
html()Return the innerHTML content of the selected element. 
innerWidth()Return the width of the first matched element.
insertAfter()Insert some HTML content after a specified element.
insertBefore()Insert some HTML content before a specified element. 
offset()Returns the offset coordinates of the selected element.
offsetParent()Find the first positioned parent element in the DOM tree.
outerHeight()Find the outer height of the specified element. 
outerWidth()Return the value of outer width of an element which includes border & padding.
position()Find the position of the first matched element relative to its parent element in the DOM tree.
prepend()Insert a specified content at the beginning of the selected element.
prependTo()Insert HTML elements or some content at the beginning of the selected element.
prop()Return properties and values for the selected elements.
remove()Remove all the selected elements including all the text. 
removeAttr()Remove one or more attributes from the selected elements.
removeClass()Remove one or more class names from the selected element.
removeProp() Remove the property set by the prop() method.
replaceAll()Replace selected elements with new HTML elements.
replaceWith()Replace the selected element with the new one.
scrollLeft()Set the horizontal position of the scroll bar.
scrollTop()Return the vertical top position of the scrollbar.
text() Return the text content of the element.
toggleClass()Change the class attached to the selected element.
unwrap()Remove the parent element from the selected element.
val()Set the value of an attribute for the selected elements. 
width()Check the width of an element.
wrap()Wrap the specified element around the selected element.
wrapAll()Specified elements will be wrapped against all the selected elements.
wrapInner()Wrap the HTML element around the content of each selected element.

Next Article
jQuery HTML/CSS Methods Complete Reference

V

Vishal_Khoda
Improve
Article Tags :
  • Web Technologies
  • JQuery
  • jQuery-HTML/CSS

Similar Reads

    jQuery Tutorial
    jQuery is a lightweight JavaScript library that simplifies the HTML DOM manipulating, event handling, and creating dynamic web experiences. The main purpose of jQuery is to simplify the usage of JavaScript on websites. jQuery achieves this by providing concise, single-line methods for complex JavaSc
    8 min read
    Getting Started with jQuery
    jQuery is a fast lightweight, and feature-rich JavaScript library that simplifies many common tasks in web development. It was created by John Resign and first released in 2006. It makes it easier to manipulate HTML documents, handle events, create animations, and interact with DOM(Document Object M
    4 min read
    jQuery Introduction
    jQuery is an open-source JavaScript library that simplifies the interactions between an HTML/CSS document, or more precisely the Document Object Model (DOM). jQuery simplifies HTML document traversing and manipulation, browser event handling, DOM animations, Ajax interactions, and cross-browser Java
    7 min read
    jQuery Syntax
    The jQuery syntax is essential for leveraging its full potential in your web projects. It is used to select elements in HTML and perform actions on those elements.jQuery Syntax$(selector).action()Where - $ - It the the shorthand for jQuery function.(selector) - It defines the HTML element that you w
    2 min read
    jQuery CDN
    A Content Delivery Network (CDN) is a system of distributed servers that deliver web content to users based on their geographic location. Including the jQuery CDN in your project can improve the performance, enhance reliability, and simplify maintenance.What is a jQuery CDN?A jQuery CDN is a service
    4 min read

    jQuery Selectors

    JQuery Selectors
    What is a jQuery Selector?jQuery selectors are functions that allow you to target and select HTML elements in the DOM based on element names, IDs, classes, attributes, and more, facilitating manipulation and interaction. Syntax: $(" ")Note: jQuery selector starts with the dollar sign $, and you encl
    5 min read
    jQuery * Selector
    The jQuery * selector selects all the elements in the document, including HTML, body, and head. If the * selector is used together with another element then it selects all child elements within the element used. Syntax: $("*")Parameters: *: This parameter is used to select all elements.Example 1: Se
    1 min read
    jQuery #id Selector
    jQuery is an open-source JavaScript library that simplifies the interactions between an HTML/CSS document, or more precisely the Document Object Model (DOM), and JavaScript. Elaborating on the terms, it simplifies HTML document traversing and manipulation, browser event handling, DOM animations, Aja
    1 min read
    jQuery .class Selector
    The jQuery .class selector specifies the class for an element to be selected. It should not begin with a number. It gives styling to several HTML elements. Syntax: $(".class") Parameter: class: This parameter is required to specify the class of the elements to be selected.Example 1: In this example,
    1 min read

    jQuery Events

    jQuery Events
    jQuery events are actions or occurrences that happen on a web page, such as clicks, hover, or keypress. jQuery provides methods to handle and respond to these events with ease. jQuery events are used to create dynamic web pages. Syntax: $(selector).method(function)Here We will explore some basic eve
    4 min read
    jQuery bind() Method
    The jQuery bind() method is used to attach one or more event handlers for selected elements. This method specifies a function to run when an event occurs.  Syntax$(selector).bind(event, data, function);ParametersIt accepts three parameters that are described below: event: This is an event type that
    2 min read
    jQuery blur() Method
    jQuery blur() is an inbuilt method that is used to remove focus from the selected element. This method starts the blur event or it can be attached a function to run when a blur event occurs.  Syntax:$(selector).blur(function)Parameters: It accepts an optional parameter "function".  jQuery examples t
    1 min read
    jQuery change() Method
    The jQuery change() method is used to detect changes in the value of form elements like ,