Remove html button with js

Hi, I have some code below that creates a button in html form. When the user entered some information using the button, I want the form to reflect this by deleting the button and replacing it with plain text. I tried to get the internal html and use divs, but nothing works, can anyone help? I'm not looking for anyone to write code for me, just a few pointers would be great. thank

  <td class="col1"><h3>Associated with :</h3></td>
  <td class="col3">
  <input type="button" 
  value="Associate this job " 
  onclick="associate()" 
/></td>
+5
source share
3 answers

Add spanwith an attribute idaround what you want to change. When this time, here is all you need to do:

    document.getElementById("spanIDhere").innerHTML = "Your text here";

So, for example, you will have a line:

    <span id="associatespan">
        <input type="button" value="Associate this job" onclick="associate()" />
    </span>

script :

    document.getElementById("associateSpan").innerHTML = "Look, no more button!";
+4

DIV DIV, . , DIV DIV.

+2

I suggest you take a look at one of the Javascript tools that makes it very easy. For example, I used Prototype for this. Specific Element.hide () method and example usage on the page.

+1
source

All Articles