Knowledge Walls
Hyderabad, Andhra Pradesh, India
JQuery - Add Elements in JQuery of JQuery

Add New HTML Content

We will look at four jQuery methods that are used to add new content:

  • append() - Inserts content at the end of the selected elements
  • prepend() - Inserts content at the beginning of the selected elements
  • after() - Inserts content after the selected elements
  • before() - Inserts content before the selected elements

jQuery Manipulating CSS

jQuery has several methods for CSS manipulation. We will look at the following methods:

  • addClass() - Adds one or more classes to the selected elements
  • removeClass() - Removes one or more classes from the selected elements
  • toggleClass() - Toggles between adding/removing classes from the selected elements
  • css() - Sets or returns the style attribute

jQuery Dimension Methods

jQuery has several important methods for working with dimensions:

  • width()
  • height()
  • innerWidth()
  • innerHeight()
  • outerWidth()
  • outerHeight()
<!DOCTYPE html>
    <html lang="en-US">
        <meta charset="UTF-8">
        <script   src=""   integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="   crossorigin="anonymous"></script>
                   var newmember1= $("<div></div>");
                    var newmember2=$("<div></div>");
                    var newmember3="<div>7</div>";//direct
                    var newmember4=document.createElement("div");//javascript
             background-color: red;   
             width: 300px;
             height: 300px;
        <div id="no">
        <div id="no2">
        <button id="doit">do it</button>
        <button id="remove">remove</button>
        <button id="empty">empty</button>
        <button id="addclass1">addclass</button>
        <button id="removeclasses">remove</button>
        <div class="addclasses">element</div>
Previous Topics
Previous lessons of current book.
JQuery of JQuery
JQuery of JQuery
JQuery of JQuery
Best Lessons of "JQuery"
Top lessons which are viewed more times.
JQuery of JQuery
JQuery of JQuery
JQuery of JQuery
JQuery of JQuery
JQuery of JQuery
JQuery of JQuery
JQuery of JQuery
  Copyright © 2014 Knowledge walls, All rights reserved
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details