user755806
user755806

Reputation: 6825

Script error only in IE browser using jquery?

Hi Iam using HTML/javascript/jquery. But i am getting below error in IE alone.I am using IE7 and XP.

enter image description here

below is the code:

$(function(){
    $("select").multiselect();
    var i =1;
    $("select").change(function () {
        var str = $(this).val();
        $('.lbCriteriaContainer').html('');
        $.each(str, function(index, value) {
            var liTag = $('<li class="lbAlt"></li>');
            var removeIcon= $('<img src="images/cross.jpg" style="cursor: pointer;width: 15px;padding-top: 3px;">');
            var textElement=$('<span>'+value+'</span>');
            liTag.append(removeIcon);
            liTag.append(textElement);
            $('.lbCriteriaContainer').append(liTag);

            removeIcon.bind('click',function(){
                liTag.remove();
                $('select [value='+value+']').removeAttr('selected');
                $('select').multiselect('refresh');
            });
        });

    }).change();


<script type="text/javascript" src="js/jquery-1.6.js" ></script>

<link rel="stylesheet" type="text/css" href="css/jquery.multiselect.css" />
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/ui-lightness/jquery-ui.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>
<script src="js/jquery.multiselect.js" type="text/javascript"></script>

Thanks!

Upvotes: 0

Views: 3123

Answers (1)

mcgrailm
mcgrailm

Reputation: 17638

You’re missing the closing brace and parenthesis of the $(function(){ statement:

and this section should be after all the included script loaded ;) – jogesh_pi

<link rel="stylesheet" type="text/css" href="css/jquery.multiselect.css" />
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/ui-lightness/jquery-ui.css" />
<script type="text/javascript"  src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>
<script src="js/jquery.multiselect.js" type="text/javascript"></script>

$(function(){
    $("select").multiselect();
    var i =1;
    $("select").change(function () {
        var str = $(this).val();
        $('.lbCriteriaContainer').html('');
        $.each(str, function(index, value) {
            var liTag = $('<li class="lbAlt"></li>');
            var removeIcon= $('<img src="images/cross.jpg" style="cursor: pointer;width: 15px;padding-top: 3px;">');
            var textElement=$('<span>'+value+'</span>');
            liTag.append(removeIcon);
            liTag.append(textElement);
            $('.lbCriteriaContainer').append(liTag);

            removeIcon.bind('click',function(){
                liTag.remove();
                $('select [value='+value+']').removeAttr('selected');
                $('select').multiselect('refresh');
            });
        });

    }).change();
});

Upvotes: 2

Related Questions