开发者

jquery latest conflict, having difficulty troubleshooting

Hello All and thanks ahead for any help

I'm working on a website which references a global template that calls jquery-latest-min.js

So before you ask, the version will change beyond my control.

After many hours of troubleshooting some jquery code, I've found that removing the call for jquery latest will make the code work again, however when it's broken, the following code doesn't return th开发者_如何学运维e correct option index. If you remove jquery latest, it works.

<html>
<head>
<script type="text/javascript" src="jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="jquery-latest-min.js"></script> <!-- THIS IS THE ONE CAUSING CONFLICT -->
<script type="text/javascript">
    $(function() {
        $("div.click").click(function(){
            selectedOptionIndex = $("#mySelect option:selected").index();
            alert(selectedOptionIndex); // should alert "0"
        });
    });
</script>
</head>
<body>
    <select id="mySelect">
        <option value="">0</option>
        <option value="">1</option>
        <option value="">2</option>
        <option value="">3</option>
    </select>
    <div class="click">
        Click
    </div>
</body>
</html>

Is there something I'm doing wrong, or is there a problem with jquery latest? The version in particular here is v1.3.2


You're including two versions of jQuery, that's probbaly causing the conflicts.

<script type="text/javascript" src="jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="jquery-latest-min.js"></script>

You only need one. So try removing the jquery-1.4.4.min.js.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜