$(function() {
$('#dialog').click(function() {
alert("hello");
});
});
$('select').yaselect();
I am genuinely confused about how javascript script inclusion works. So the click handler for the dialog works fine. But the yaselect does not. I get $("select").yaselect is not a function
So jQuery seems to work, but the yaselect somehow not. It is included in the head section of the file though.
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/libs/jquery-1.7.2.min.js?"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/libs/jquery-ui-1.8.20.custom.min.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/libs/jquery.yaselect.min.js"></script>
However, the yii framework somehow includes jquery again later in the head section:
<script type="text/javascript" src="/assets/ab20866e/jquery.js"></script>
<script type="text/javascript" src="/assets/ab20866e/jquery.yiiactiveform.js"></script>
I understand this might be a problem, however I took over this code, I am new to yii and so am confused about what to do.
var foo = jQuery.noConflict()
statement after the first<script...></script>
tag-pair and before the second. Otherwise, the second version will simply overwrite the first, such that the second endures for the life of the page.