I'm new to JQuery and really struggling how to perform the query I want.
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.
I assume I need to search for span within the .ms-error class that contains the words 'External Data' and hide it.
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>
Please can someone help me with the JQuery.
Here's more optimised and faster approach:
And additionally, this syntax works as a charm when you require a sort of regex pattern to find all matching nodes or nodes with similar classnames. Suppose, you need to find something .ms-error-1 .ms-error-abc. So, same syntax works and even better you could do like this:
$('span.ms-error:contains("External Data")').hide();
If you know for sure that these
span
's are inside a certaintable
or adiv
then target it specifically inside those to make the script perform better.eg.
$('.ms-usereditor span.ms-error:contains("External Data")').hide();