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.
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
$('span.ms-error:contains("External Data")').hide();
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.
eg.
$('.ms-usereditor span.ms-error:contains("External Data")').hide();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With