jQuery element Selector

By: Bipin C Mathew 1 year, 7 months ago

The Element Selector Selects all elements with the given tag name. In the Element Selector we can list the names of the element to be selected in the parenthesis. For example $("h2") will select all h2 element of the HTML page, similarly $("p") will select all the paragraph elements of the page.  We can use the element selector to select an element whose name is passed in the parenthesis inside $().

Syntax  $("element")


<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>element demo</title>
   div, span {
         width: 60px;
         height: 60px;
         float: left;
         padding: 10px;
         margin: 10px;
         background-color: #eee;
<script src="https://code.jquery.com/jquery-3.4.1.js"></script>


      $( "div" ).css( "border", "9px solid red" );
      $( "span" ).css( "border", "9px solid green" );




Let us talk!

We take the vision which comes from dreams and apply the magic of science and mathematics, adding the heritage of our profession and our knowledge to create a design.