Total newbie.
Any help appreciated.
Why does replaceAll only seem to work once in this example?

Thanks very much!

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                    "http://www.w3.org/TR/html4/loose.dtd";>
<html>
<head>
<script src="js/jquery.js" type="text/javascript"></script>

  <script>
  var i = 0;
  $(document).ready(function(){


    $("#firstButton").click(function () {
      $("#hello").replaceWith("foo");
    });
        $("#secondButton").click(function () {
      $("#hello").replaceWith("bar");
    });

  });
  </script>

</head>
<body>
  <button id="firstButton">First</button>
  <button id="secondButton">Second</button>
  <p>&nbsp;</p>
  <table width="300" border="0" cellpadding="1">
    <tr>
      <td id="hello">hello</td>
    </tr>
  </table>
  <p>&nbsp;</p>
</body>
</html>

Reply via email to