我下面有一些代码,用于在 html 表单上创建一个按钮。当用户使用按钮输入一些信息时,我希望表单通过删除按钮并将其替换为纯文本来反映这一点。我尝试获取内部 html 并使用 div,但没有任何效果,有人可以帮忙吗?我并不是在寻找任何人为我编写代码,只要有一些建议就很好了。
<td class="col1"><h3>Associated with :</h3></td>
<td class="col3">
<input type="button"
value="Associate this job "
onclick="associate()"
/></td>
Add a span
与id
属性围绕您想要更改的任何内容。当时间到了,你需要做的就是:
document.getElementById("spanIDhere").innerHTML = "Your text here";
例如,你会有这样的行:
<span id="associatespan">
<input type="button" value="Associate this job" onclick="associate()" />
</span>
你的脚本会说:
document.getElementById("associateSpan").innerHTML = "Look, no more button!";
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)