开发者

Jquery autoselect not working on IE8

I've 开发者_如何学JAVAused the source off this page: http://jqueryui.com/demos/autocomplete/#multiple

All that I've changed is the list. This works fine under Firefox, but fails on IE with the message below.

Do I need to add one of those compliance tags?

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.5.30729; .NET CLR 3.0.30618) Timestamp: Wed, 3 Aug 2011 15:56:02 UTC

Message: 'label' is null or not an object Line: 329 Char: 114 Code: 0 URI: ../jquery-ui-1.8.14.custom.min.js

Message: 'label' is null or not an object Line: 329 Char: 114 Code: 0 URI: ../jquery-ui-1.8.14.custom.min.js

<script type="text/javascript">
    $(function() {
        var tagsArray = [<?php foreach($tags as $tag){echo '"'.$tag->name.'",';} ?>];
        function split( val ) {
            return val.split( /,\s*/ );
        }
        function extractLast( term ) {
            return split( term ).pop();
        }

        $( "#tags" )
            .bind("keydown",function(event){
                if(event.keyCode === $.ui.keyCode.TAB &&
                        $(this).data("autocomplete").menu.active){
                    event.preventDefault();
                }
            })
            .autocomplete({
                minLength: 0,
                source: function(request, response){
                    response($.ui.autocomplete.filter(
                        tagsArray, extractLast(request.term)));},
                focus: function() {return false;},
                onSelect: function() {},
                select: function(event, ui){
                    var terms = split(this.value);
                    terms.pop();
                    terms.push(ui.item.value);
                    terms.push("" );
                    this.value = terms.join(", ");
                    return false;
                }
            });
    });
</script>


It's the trailing , at the end of the list (which is acceptable is most other languages, but it appears not JS in IE8). Thanks for the help!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜