I am trying to use parsley js but unfortunately it's not working

1.2k views Asked by At

I am using parsley Js but unfortunately it's not working please help me how can i resolve that thanks.

console error

jquery-3.6.0.min.js:2 jQuery.Deferred exception: $(...).parsley is not a function TypeError: $(...).parsley is not a function at HTMLDocument. (http://localhost/permit-to-work/cms/public/branch/add:313:14) at e (https://code.jquery.com/jquery-3.6.0.min.js:2:30038) at t (https://code.jquery.com/jquery-3.6.0.min.js:2:30340) undefined

html view

<form class="form"  action="{{$isEdit ? route('branch.update', [$branchs->id]) : route('branch.store')}}" method="post" autocomplete="off"  >
   @csrf
    <input type="text" name="name"  value="{{$branchs->name ?? old('name') ?? null}}" parsley-trigger="change"  placeholder="Name..." class="form-control" required>
</form>

script

<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="{{url('')}}/plugins/parsleyjs/parsley.min.js"></script>

<script>
 jQuery(document).ready(function () {
  $('.form').parsley();
  });
  </script>
1

There are 1 answers

0
AudioBubble On

I was facing the same issue. Using the CDN

<script src="https://cdnjs.cloudflare.com/ajax/libs/parsley.js/2.9.2/parsley.js" integrity="sha512-Fq/wHuMI7AraoOK+juE5oYILKvSPe6GC5ZWZnvpOO/ZPdtyA29n+a5kVLP4XaLyDy9D1IBPYzdFycO33Ijd0Pg==" crossorigin="anonymous"></script>

instead of the min js worked for me.