0

I've changed the layout file in yii and now the problem with identifying the select2 function. enter image description here I've checked the source code - seems identical in both cases. In both of them the select2.js is present: <script type="text/javascript" src="/app3/assets/b92019fc/select2.js"></script>

Source code of one where the problem appears:

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" type="image/ico" href="/app2/img/favicon.ico">

 some css files are here... 

<script type="text/javascript" src="/app3/assets/df744518/jquery.js"></script>
<script type="text/javascript" src="/app3/assets/df744518/jquery.ba-bbq.js"></script>
<script type="text/javascript" src="/app3/assets/df744518/jui/js/jquery-ui.min.js"></script>
<script type="text/javascript" src="/app3/assets/df744518/jquery.yii.js"></script>
<script type="text/javascript" src="/app3/assets/b92019fc/select2.js"></script>
<title>tarex. Page3</title>

 some css files are here... 

<script src="js/jquery.js"></script>
<script src="js/bootstrap.js"></script> 
    <script type="text/javascript" src="assets/35648952/jquery.yii.js"></script>
<script type="text/javascript">
jQuery(function($) {    
    jQuery('body').on('change','#_lang',function(){jQuery.yii.submitForm(this,'',{});return false;}); 
 jQuery('body').on('change','#Cityes_Name',function(){jQuery.yii.submitForm(this,'',{});return false;});
}); 
</script>
<script language='javascript'>       
            var RoleId=1; 
            var UserName='admin'; 
            var UserId='36'; 
            var OrganizationId='7'; 
            var Language='ru'; 
            //console.log('Language '+Language);</script>
</head>

The source code where there is no problem:

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="language" content="en" /> 
<link rel="shortcut icon" type="image/ico" href="/app2/img/favicon.ico">

<script language='javascript'>       
            var RoleId=1; 
            var UserName='admin'; 
            var UserId='36'; 
            var OrganizationId='7'; 
            var Language='ru'; 
            //console.log('Language '+Language);</script>
    <!-- blueprint CSS framework --> 
 some css files are here... 

<script type="text/javascript" src="/app3/assets/df744518/jquery.js"></script>
<script type="text/javascript" src="/app3/assets/df744518/jquery.ba-bbq.js"></script>
<script type="text/javascript" src="/app3/assets/df744518/jquery.yii.js"></script>
<script type="text/javascript" src="/app3/assets/b92019fc/select2.js"></script>
<title>Главное меню</title>

</head>

What might be the problem in?

1 Answer 1

1

You are applying jQuery few times. Load jQuery only once with Yii::app()->clientScript->registerCoreScript('jQuery')

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.