JQuery Selector Multiple Selector

From CoderLearner
Jump to: navigation, search

Description

Select multiple elements.

Syntax

$("element, element2, element3")

Example 1

<!DOCTYPE html>
<html>
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <title>Select</title>
      <script 
         type="text/javascript" 
         src="/lib/jquery-1.7.2.min.js">				 
      </script>
      <script>
         $().ready(function() {
            $("div,span.u10 a,p").css("color","red");
         });
      </script>
   </head>
   <body> 
      <div>
         Division
      </div>
      <p>
         Great Leader
      </p>
      <span>
         <a href="#">URL</a>
      </span>
      <span class="u10">
         <a href="#">Students</a>
         *** Not Included ***
      </span>
   </body>
</html>

Try It