[Solved] Setting button title in HTML to a non-formatted text


The innerText attribute will do the work:

<body>
<button type="button" id="button1" onclick="foo()">Result!</button>
  <script type="text/javascript">
  function foo() {
    var button = document.getElementById("button1");
    button.innerText = "<strong>my text</strong>"
  }
  </script>
</body>

Note: Firefox doesn’t support innerText, but has its own property called textContent, which can be used instead.

0

solved Setting button title in HTML to a non-formatted text