1try { 2 document.addEventListener("DOMContentLoaded", function () { 3 $.validator.addMethod("requiredifselected", function (value, element, parameters) { 4 var dependentProperty = $('#' + parameters['dependentproperty']); 5 var targetValues = parameters['targetvalues'].split(','); 6 if (dependentProperty.length && targetValues.includes(dependentProperty.val())) { 7 return $.trim(value) !== ''; 8 } 9 return true; 10 }); 11 12 $.validator.unobtrusive.adapters.add('requiredifselected', ['dependentproperty', 'targetvalues'], function (options) { 13 options.rules['requiredifselected'] = { 14 dependentproperty: options.params.dependentproperty, 15 targetvalues: options.params.targetvalues 16 }; 17 options.messages['requiredifselected'] = options.message; 18 }); 19 }); 20} 21catch (error) { console.log(error) }
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.