Error: 'KTUtil' is undefined?
Hi,
I have this Error: 'KTUtil' is undefined?
Can you advise?
Thanks
Replies (2)
Hi,
Please make sure that you called your js code after the core js scripts at the bottom of the page.
Please make sure that plugins.bundle.js and scripts.bundle.js are included in the page which contains KTUtil class:
<!--begin::Global Javascript Bundle(mandatory for all pages)-->
<script src="/assets/plugins/global/plugins.bundle.js"></script>
<script src="/assets/js/scripts.bundle.js"></script>
<!--end::Global Javascript Bundle-->
<script>
// On document ready
KTUtil.onDOMContentLoaded(function () {
// run your code
});
</script> Regards.
In <b>master.blade.php</b>:
<head>
<!-- head content -->
</head>
<body>
@yield("content")
<script src="{{ asset("assets/js/app.js") }}"></script>
<script src="{{ asset("assets/plugins/global/plugins.bundle.js") }}"></script>
<script src="{{ asset("assets/js/scripts.bundle.js") }}"></script>
@yield("scripts")
</body> In <b>_default.blade.php</b>:
@extends("layout.master")
@section("content")
@endsection
@section("scripts")
@parent <!-- Include the global scripts from master.blade.php -->
@endsection In <b>articles.blade.php:</b>
<x-default-layout>
//some content
@section("scripts")
var KTArticlesList;
KTUtil.onDOMContentLoaded(function() {
KTArticlesList.init();
});
@endsection
</x-default-layout> same getting KTUtil not defined error. Please advice. i even tried copying the section('scripts') code in activities.blade.php to master.blade.php AFTER the global scripts, but it's still undefined.