0

我想隐藏<span>标签内的内容,但带有特定的文本:

<span class="ms-RadioText" title="Created / Criar"><input id="ctl00_m_g_178a35bf_4d92_4887_8b39_b6e6e11d4a09_ff21_ctl00_ctl00" type="radio" name="ctl00$m$g_178a35bf_4d92_4887_8b39_b6e6e11d4a09$ff21$ctl00$RadioButtons" value="ctl00" checked="checked" /><label for="ctl00_m_g_178a35bf_4d92_4887_8b39_b6e6e11d4a09_ff21_ctl00_ctl00">Created / Criar</label></span>
<span class="ms-RadioText" title="Change / Alterar"><input id="ctl00_m_g_178a35bf_4d92_4887_8b39_b6e6e11d4a09_ff21_ctl00_ctl01" type="radio" name="ctl00$m$g_178a35bf_4d92_4887_8b39_b6e6e11d4a09$ff21$ctl00$RadioButtons" value="ctl01" /><label for="ctl00_m_g_178a35bf_4d92_4887_8b39_b6e6e11d4a09_ff21_ctl00_ctl01">Change / Alterar</label></span>

我必须隐藏类“ms-RadioText”的内容和标题标签“Created / Criar”

4

4 回答 4

2

所以只需定位该元素:

$('span.ms-RadioText[title="Created / Criar"]').hide();

注意:属性选择器也适用于 CSS3。

于 2013-08-20T14:55:00.127 回答
0

您可以使用选择器标题:

.ms-RadioText[title='Created / Criar']
{
  display: none;
}

工作演示在这里

于 2013-08-20T14:58:19.793 回答
0
 //This removes it from the page
 $('span.ms-RadioText[title="Created / Criar"]').hide();  

 //same as above
 $('span.ms-RadioText[title="Created / Criar"]').css('display', 'none'); 

 //This makes it invisible, but it still exists in document flow
 $('span.ms-RadioText[title="Created / Criar"]').css('visibility', 'none'); 
于 2013-08-20T14:55:43.947 回答
0

以下 jQuery 选择器将为您工作:

$('span.ms-RadioText[title="Created / Criar"]')

通过将它与 jQuery 的hide()函数组合如下,你应该得到你所期望的:

$('span.ms-RadioText[title="Created / Criar"]').hide();

这是一个jsFiddle 演示

于 2013-08-20T14:55:52.590 回答