Hi,
I have this Error: 'KTUtil' is undefined?
Can you advise?
Thanks
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>
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>
@extends("layout.master")
@section("content")
@endsection
@section("scripts")
@parent <!-- Include the global scripts from master.blade.php -->
@endsection
<x-default-layout>
//some content
@section("scripts")
var KTArticlesList;
KTUtil.onDOMContentLoaded(function() {
KTArticlesList.init();
});
@endsection
</x-default-layout>