John Davidson

php - Include js after bootstrap 4 bundle file

0 comments
Message:


I'm trying to include js files after the bootstrap.bundle.js. i have this in my view


 $this->registerJsFile('https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap-select.min.js', ['depends' => [yii\bootstrap4\BootstrapAsset::className()]]);
$this->registerCssFile('https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap-select.min.css', ['depends' => [yii\bootstrap4\BootstrapAsset::className()]]);

but when i view source. it still shows above it. any idea how to fix this? thanks



<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.js"></script>

<script src="/yii2/frontend/web/assets/949bae38/yii.js"></script>

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/sweetalert2.all.min.js"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/mhayes-twentytwenty/2.0.0-beta.1/jquery.twentytwenty.min.js"></script>

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap-select.min.js"></script>

<script src="/yii2/frontend/web/assets/949bae38/yii.validation.js"></script>

<script src="/yii2/frontend/web/assets/949bae38/yii.activeForm.js"></script>

<script src="//cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/owl.carousel.min.js"></script>

<script src="/yii2/frontend/web/assets/536f059b/js/bootstrap.bundle.js"></script>


My Answer:
>load->view('includes/header');
$this->load->view('includes/navbar');
$this->load->view('includes/sidebar');
$this->load->view('includes/content');
$this->load->view('includes/footer');
$this->load->view('includes/scripts');
?>

In the 'scripts' view file, you can include your additional js files after the bootstrap.bundle.js file like this:

html








This way, the additional js files will be included after the bootstrap.bundle.js file in your view.

Rate this post

4 of 5 based on 4148 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us