Valid XHTML 1.0 Transitional

jQuery: Selecting elements by attribute value

This is paragraph uno.

This is paragraph 2.

Dies ist Absatz 3.

This is paragraph 4.

The jQuery Code START
        
    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
    <script type="text/javascript">
    
      function setStyleG() {
        $('p[lang="German"]').css("font-style","italic");
      }
      
      function setStyleE() {
        $('p[lang="English"]').css("font-style","italic");
      }
      
      function setStyleS() {
        $('p[lang="Spanish"]').css("font-style","italic");
      }
      
      function ResetStyle() {
        $('p[lang="Spanish"]').css("font-style","normal");
        $('p[lang="English"]').css("font-style","normal");
        $('p[lang="German"]').css("font-style","normal");
      }
      
    </script>
    
    <style type="text/CSS">
    <!--
        .code { color: red; }
        .back { background-color: yellow; }
    -->
    </style>
  </head>

  <body>
  <h1>jQuery: Selecting elements by contained text</h1>
  <div>
  <p lang="Spanish">This is paragraph uno.</p>
  <p lang="English">This is paragraph 2.</p>
  <p lang="German">Dies ist Absatz 3.</p>
  <p>This is paragraph 4.</p>
  </div>
  <form action="">
   <input type="button" value="Select German" onclick="setStyleG()"></input>
   <input type="button" value="Select English" onclick="setStyleE()"></input>
   <input type="button" value="Select Spanish" onclick="setStyleS()"></input>
   <input type="button" value="Reset" onclick="ResetStyle()"></input>
   
  </form>