簡體   English   中英

如何在javascript中隱藏對“ for”屬性具有特定值的標簽標記?

[英]How to hide a label tag in javascript that has a certain value for the “for” attribute?

標簽的“ for”屬性具有單選按鈕的ID。 我可以隱藏單選按鈕,但不能隱藏標簽。 如何隱藏標簽??

如果您使用jQuery:

$('#radio_btn').hide();
$('label[for="radio_btn"]').hide();

或使用不同的標記:

HTML:

<label for="radio"><input type="radio" id="radio"> Radio</label>​

JS:

$('label[for="radio"]').hide();

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM