我是JQuery的新手,真的很难如何执行我想要的查询.
我正在使用SharePoint,当使用外部数据列并将其设置为必填字段时,错误消息始终显示,直到您填写数据.与其他类型的列不同,它们仅在您单击"确定"/"保存"并且未填充数据后才出现.因此,我需要从这些类型的列中删除错误消息文本.
我假设我需要在包含"外部数据"字样的.ms-error类中搜索span并隐藏它.
从使用IE开发人员工具栏,我已经确定了该区域.
<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>
Run Code Online (Sandbox Code Playgroud)
请有人帮我使用JQuery.
jba*_*bey 30
var spans = $('.ms-error');
spans.text(''); // clear the text
spans.hide(); // make them display: none
spans.remove(); // remove them from the DOM completely
spans.empty(); // remove all their content
Run Code Online (Sandbox Code Playgroud)
$('span.ms-error:contains("External Data")').hide();
如果您确定这些span's 在某个table或 a 内,div则将其专门定位在那些内以使脚本执行得更好。
例如。
$('.ms-usereditor span.ms-error:contains("External Data")').hide();
| 归档时间: |
|
| 查看次数: |
51215 次 |
| 最近记录: |