简体   繁体   中英

JQuery multiple class selectors fails in IE6

I make use of class selectors in JQuery and this works fine but in IE6 this fails as it does not apply the width I would like.

    $('.ui-state-default .ui-jqgrid-hdiv').css('width', width);

If I try it one class it works?? But I need to apply that width to a div that has both those classes.

Thanks all for any help.

Update

$onselect = <<<loadComplete
function go_size(){

        var width = document.documentElement.clientWidth - 45;
        $('#gbox_grid').css('width', width);
        $('#gview_grid').css('width', width);
        $('#pager').css('width', width);
        $('.ui-state-default .ui-jqgrid-hdiv').css('width', width);
        $('.ui-jqgrid-bdiv').css('width', width)

}
loadComplete;

Remove the space between the class names. With your posted selector, you search for a child element .ui-jqgrid-hdiv inside a parent .ui-state-default .

Look here (W3C) and here (jQuery) for how to write selectors.

Also, look, if the class attribute spans multiple lines in the HTML source. IE 6 can't handle that correctly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM