How to deal with select2 inline css?

Inline CSS is not allowed in page, but some cases we need to use inline CSS on html code.

Currently I’m using select2 library on my project and I have style="width: 100%" on of my all select2 element of that project. :frowning:
I separate all other CSS element to external file, but without this select2

On official documentation of select2 this also mention here

This is not possible to remove this inline CSS, then how can I deal with this situation?

Either use .css class to add the style or jQuery to add the style to the div.

CSS class is not working here, only inline css works well.
This is also mention on the select2 official documentation here

Here is a StackOverflow answer

$('#click-me').on('click', function(event) { 
   $('.select2').select2({width: '100%'});

From the link you have submitted

1 Like

Thank you, unfortunately that’s not working for all select element. I will remove select2.