I am using below code to remove duplicate values from a lookup column called Project Name and for some reason its not working, can someone please help me correct it.
FYI, i have already enforced unique values for the lookup column but it does not seem to do the job.
Below is the code:
<script language="javascript" type="text/javascript"
src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script type="text/javascript">
var previousOption2;
$(document).ready(function() {
$('#Company_x0020_Name').parent().next().find('select option').each(function() {
if (this.text == previousOption2) $(this).remove();
previousOption2= this.text;
});
});
</script>
This is the ID i get to see: Company_x0020_Name
Below is the screenshot of the form:
