How to exclude rendering existing script in DOM in Yii2

Link

How to exclude in rendering already existing scripts in DOM in Yii2

What method (render or renderAjax etc.) i have to use to exclude rendering one more (the same) jquery, jquery.ui

I have jquery.js on my page. And i (via ajax) load to my page modal window of registration, that requires jquery.js, and it pulls jquery.js second time.

And in the result my page contains 2 jquery.js library. And somewhere starts ocurring errors. I want to fix it by remoeving enother jquery.js

Bizley

I'm not sure if you are using AssetBundle class but if not - you should.

There is already defined yii\web\JqueryAsset with jquery.js you can use. Now you can create AssetBundle with your script that will depend on JqueryAsset (read more about assets dependency in the Guide). No matter how many times this asset is registered JqueryAsset will be registered only once.

You can do the same when adding single js file with registerJsFile() - in options array you can use 'depends' key with the JqueryAsset.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

In Yii2, how can I exclude layout from rendering in a view file?

How to exclude navbar from my login page in yii2

How to add a checkbox column to existing gridview columns in yii2?

Yii2 How to add parameters to script tag

Webpack2, how to exclude react and react dom from build

How to exclude text from `<script>` tag within the HTML DOM when calling `element.getText()`

yii2 How to count days between dates exclude weekends and holiday

How to exclude CustomResourceDefinition from rendering in Helm?

How to fetch already existing records in MySql with start_time and end_time in yii2?

Yii2 model to exclude related records

PHP - Yii2 MPDF not rendering tables

how to remove 0="3" attribute from script tag in yii2?

How to exclude specific JSON objects when rendering data

Angular 2 Chrome DOM rendering problems

How to exclude/include google maps in jmeter script?

How to exclude directories from tar in this script?

How can I exclude folders with this backup script?

How to exclude a link in a smooth scrolling script? (jQuery)

yii2 Pjax + java script prompt

Use inline script in views yii2

How to uncomment inline script in DOM

android gradle:how to exclude existing translation/locale from apk?

How to add an exclude constraint with an existing index with specified operator?

How to create rows by 'Exclude' condition and to expand into the existing Dataframe?

How to Exclude pre-existing Tables from Doctrine Migrations in Symfony?

Yii2: How to add textarea in yii2

Yii2: exclude specific controller actions from '$this->goBack()'

Rendering views in other places in Yii2 - no renderPartial?

Yii2 rendering view doesn't work correctly

TOP Ranking

HotTag

Archive