Search code examples
jqueryjquery-selectbox

jquery custom selectboxes - width and height issue


I'm using the script jQuery custom selectboxes (current version: 0.6.1) from this site:

http://info.wsisiz.edu.pl/~suszynsk/jQuery/demos/jquery-selectbox/

My problem is, that the width and height of the class "jquery-selectbox-list jquery-custom-selectboxes-replaced-list" is set by an inline-style-assignment.

My original code looks like this:

<span class="anrede">
Anrede<br />
<select name="anrede" id="anrede" value="[[!+fi.anrede]]" >
<option value="select"></option>
<option value="Frau">Frau</option>
<option value="Herr">Herr</option>
</select>
</span>

If I look at the source-code of the site in Firebug the code get's changed like this:

<span class="anrede">
Anrede
<br>
<div class="jquery-selectbox jquery-custom-selectboxes-replaced" style="width: 125px;">
<div class="jquery-selectbox-moreButton"></div>
<div class="jquery-selectbox-list jquery-custom-selectboxes-replaced-list" style="width: 120px; height: 3em; display: none;">
<span class="jquery-selectbox-item value-select item-0"></span>
<span class="jquery-selectbox-item value-Frau item-1">Frau</span>
<span class="jquery-selectbox-item value-Herr item-2">Herr</span>
</div>
<span class="jquery-selectbox-currentItem"></span>
<select id="anrede" value="" name="anrede" style="display: none;">
<option value="select"></option>
<option value="Frau">Frau</option>
<option value="Herr">Herr</option>
</select>
</div>
</span>

My problem is the third div-class:

<div class="jquery-selectbox-list jquery-custom-selectboxes-replaced-list" style="width: 120px; height: 3em; display: none;">

As you can see here is an inline-style-assignment, which causes my layout issue. Does anyone know how to resolve this?

Cheers in advance!


Solution

  • Just add !important to your css rules, like so:

    .jquery-selectbox-list.jquery-custom-selectboxes-replaced-list {
        width: yourvaluepx !important;
        height: yourvaluepx !important;
    }