Replace a button with text : replaceAll « jQuery « JavaScript Tutorial






<html>
  <head>
    <script type='text/javascript' src='js/jquery-1.3.2.js'></script>
    <script type='text/javascript'>
$(document).ready(
  function() {
    $('input#id1').click(
      function($e) {
        $e.preventDefault();
        $(this).replaceWith(
          "<p>replaced</p>"
        );
      }
    );
    $('input#id2').click(
      function($e) {
        $e.preventDefault();
        $(this).replaceWith(
          "<p>replaced</p>"
        );
      }
    );
  }
);
    </script>

  </head>
  <body>
    <div>
      <input type='submit' id='id1' value='View Quote' />
    </div>
    <div>
      <input type='submit' id='id2' value='View Quote' />
    </div>
  </body>
</html>








30.88.replaceAll
30.88.1.Use tag to replace all
30.88.2.replaceAll(selector): complement to replaceWith()
30.88.3.Replace a button with text
30.88.4.Replace all with