开发者

How to hide a label using Javascript?

开发者 https://www.devze.com 2023-01-11 19:49 出处:网络
Using Javascript, how do you make开发者_如何转开发 a label invisible on a button click?I\'m not sure what you want but here goes:

Using Javascript, how do you make开发者_如何转开发 a label invisible on a button click?


I'm not sure what you want but here goes:

<label id="mylabel">Woot!!</label>

button.onclick = function() {
  document.getElementById("mylabel").style.display = "none";
}


Just from the top of my head

<input type="button" onclick="document.getElementById('labelname').style.display = 'none';" />


A label is rendered as span tag in HTML. If you know the id of any the control you can turn off its visibility through JavaScript by

document.getElementById('your-element-id').style.display='none';
0

精彩评论

暂无评论...
验证码 换一张
取 消