This project has moved. For the latest updates, please go here.

jquery script not working on SPF 2013


Hi All,

I have created one SP list on Foundation 2013 with 5 cascading lookup fields using the Advanced Lookup utility. The form is working fine but when I add the script found to auto populate the Department field (this is the only Text field) in the form it doesn't fetch any data.

I have put the Jquery-3.0.0.min.js, jquery.SPServices-2014.02.min.js and the script below (AutoFill.js) in the Scripts folder under Style Library.

On the form page I added a Content Editor Web part with the path to the script AutoFill.js. Any help will be appreciated.

The script is

<script language="javascript" type="text/javascript" src="/sites/test/style%20library/scripts/jquery-3.0.0.min.js"></script>
<script language="javascript" type="text/javascript" src="/sites/test/style%20library/scripts/jquery.SPServices-2014.02.min.js"></script>
<script language="javascript" type="text/javascript"> $(document).ready(function() { var userDepartment = $().SPServices.SPGetCurrentUser({ fieldName: "Department" }); $("input[Title='Department']").val(userDepartment); }); </script>