jQuery从跨度中删除文本 [英] Jquery remove text from span

查看:60
本文介绍了jQuery从跨度中删除文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是JQuery的新手,真的很努力地执行所需的查询.

I'm new to JQuery and really struggling how to perform the query I want.

我正在使用SharePoint,并且在使用外部数据列"并将其设置为必填字段时,始终会出现错误消息,直到您填写数据为止.与其他类型的列不同,其他类型的列仅在单击确定"/保存"后才出现,而不填写数据.因此,我只需要从这些类型的列中删除错误消息文本即可.

I'm using SharePoint, and the when using the External Data Column and set it to required field, the error message always appears until you fill in the data. Unlike other type columns where they only appear after you click OK/Save and not filled in the data. Therefore I need to remove the error message text just from these type of columns.

我假设我需要在包含单词外部数据"的.ms-error类中搜索跨度并将其隐藏.

I assume I need to search for span within the .ms-error class that contains the words 'External Data' and hide it.

通过使用IE开发人员工具栏,我已经确定了该区域.

From using IE developer toolbar, I've identified the area.

 <table class="ms-usereditor" id="ctl00_m_g_05df537a_596b_443a_a11e_764069facec8_ctl00_Field_External_539c53fe_8334_43c8_b089_cc28d7895e68_Picker_OuterTable" style="border-collapse: collapse;" border="0" cellSpacing="0" cellPadding="0">
    <tbody>
     <tr>
     <td colSpan="3">
       <span class="ms-error" id="ctl00_m_g_05df537a_596b_443a_a11e_764069facec8_ctl00_Field_External_539c53fe_8334_43c8_b089_cc28d7895e68_Picker_errorLabel">
           Text - You must specify a value before using the Check button. You can also use Select button to choose External Data.
        </span>
      </td>
      </tr>
    </tbody>
</table>

请有人可以帮助我使用JQuery.

Please can someone help me with the JQuery.

推荐答案

$('span.ms-error:contains("External Data")').hide();

如果您确定这些span位于某个tablediv内部,则将其专门定位在这些内部,以使脚本性能更好.

If you know for sure that these span's are inside a certain table or a div then target it specifically inside those to make the script perform better.

例如

$('.ms-usereditor span.ms-error:contains("External Data")').hide();

这篇关于jQuery从跨度中删除文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆