Skip to content

Select2 css width override #1032

@phillmac

Description

@phillmac

The !important on this line makes it incredibly hard to dynamically set a smaller width. This CSS file has the most priority over the other standard included CSS files, so the !important is effectively redundant.

E.g. $(".select2-container").css("width", "8%") doesn't work because the !important overrides the inline style. It's almost impossible to add a !important with jQuery, see: https://bugs.jquery.com/ticket/11173

To get around this problem, one has to resort to this sort of ugliness:
$(".select2-container")[0].style.setProperty("width", "8%", "important")

Metadata

Metadata

Assignees

No one assigned

    Labels

    frontendThe frontend interface

    Type

    No type

    Projects

    Status

    References

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions