SharePoint 2013 Jquery Error-"Uncaught TypeError: Cannot read property 'each' of undefined"

SharePoint 2013 Jquery Error-"Uncaught TypeError: Cannot read property 'each' of undefined"

Hi,

I am getting error while executing below code and image

error-Uncaught TypeError: $ is not a function


<script type="text/javascript">

$(document).ready(function() {
  var sPath = window.location.pathname;
  var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
  var isOnlyReader=isUserInGroup('',__zurichReaderID,false);

if I change $(document to Jquery(document) than It shows error in interaction.js with below code and image

Error-Uncaught TypeError: Cannot read property 'each' of undefined

if(viewFields != null && viewFields.length > 0){

result.append('<viewFields><ViewFields xmlns="">');
$.each(viewFields, function(idx, field){
result.append('<FieldRef Name="' + field + '"/>');
});
result.append('</ViewFields></viewFields>');
}