Valid XHTML 1.0 Transitional

jQuery: Setting first image title attribute

Title is set for FIRST image only


The jQuery Code START
    
    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
    <script type="text/javascript">
      function setAlt() {
        $("img:first").attr("title", "These are flowers.");
      }
    </script>
  </head>

  <body>
    <h1>jQuery: Setting first image title attribute</h1>
    <img src="image1.jpg"></img>
    <img src="image2.jpg"></img>
    <br />
    <form action="">
    <input type = "button" value="Set title attribute" onclick="setAlt()"></input>
    </form>