tadam logo
Did you find an error in the text?
Select this with mouse and press
Ctrl + Enter
Xhtml.co.il Check Spelling
Orphus system

element selector

element selector

Description: Selects all elements with the given tag name.

jQuery('element')

version added: 1.0
element
An element to search for. Refers to the tagName of DOM nodes.

JavaScript's getElementsByTagName() function is called to return the appropriate elements when this expression is used.

Examples

Finds every DIV element.
$("div").css("border","9px solid red");
The output of the code above will be:
Full source:
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>  
  <script>
  $(document).ready(function(){
$("div").css("border","9px solid red");
  });
  </script>
  <style>
  div,span {
    width: 60px;
    height: 60px;
    float:left;
    padding: 10px;
    margin: 10px;
    background-color: #EEEEEE;
  }
  </style>
</head>
<body>
  <div>DIV1</div>
  <div>DIV2</div>
  <span>SPAN</span>
</body>
</html>
Was this information helpful?
   

Comments