Friday, March 14, 2014

jquery autocomplete IE display problem

JQuery Combobox in autocomplete example (http://jqueryui.com/autocomplete/#combobox) is not working properly in some IE versions. A way to solve this problem is to disable this widget. To do this add the following lines before the widget :


function detectIE() {
    var ua = window.navigator.userAgent;
    var msie = ua.indexOf('MSIE ');
    var trident = ua.indexOf('Trident/');

    if (msie > 0) {
        // IE 10 or older => return version number
        return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10);
    }

    if (trident > 0) {
        // IE 11 (or newer) => return version number
        var rv = ua.indexOf('rv:');
        return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10);
    }

    // other browser
    return false;
}


(function($) {
    if (detectIE()>6 || detectIE()==false { $.widget("ui.combobox", { ..... }); 
})(jQuery);

No comments:

Post a Comment