Jquery Validation in Sharepoint People Picker

If you have a custom form and you had placed people picker control in it and you need to validate it using jquery. please use the following jquery. You should have placed your spservices and jquery library in site library well in hand before that.

<script type="text/javascript" src="http://mysites/SiteAssets/jquery-1.6.4.min.js"></script>
<script type="text/javascript" src="http://mysites/SiteAssets/jquery.SPServices-0.6.2.min.js"></script>
<script type="text/javascript">

$(document).ready(function() {

var username =$().SPServices.SPGetCurrentUser({
fieldName: "Title"
});

var user= $("#customPeoplePicker").text();
if (username==user)

{

$("input[value='Submit']").attr('disabled',true);

}

});
Happy Share Pointing :-)

Vijay Kumari

Chief Editor at C# Corner, I bring expertise in Java, Android, and C++. Additionally, I possess a foundational understanding of HTML, CSS, Bootstrap, JavaScript, and PHP. My responsibilities include content publishing an... Read more

https://www.c-sharpcorner.com/members/vijay-kumarihttps://x.com/VijayT73689https://www.linkedin.com/in/vijay-rawat-a9323a193/