Skip to content Skip to sidebar Skip to footer

Using Chosen.js, How Would I Add Images To The Dropdown Items?

Using chosen.js, how would I add images to the dropdown items?

Solution 1:

By setting a background-image on chosen's list items:

.chzn-resultsli {
    background: url('path/to/img.png') no-repeat 3px center;
    padding-left: 12px;
}

Adjust the pixel count accordingly.

Solution 2:

To complete Joseph (I can't add comment to his answer), the class has changed since an unknown version: Here's the correct css in v1.0.0:

li.active-result {
    background: url('path/to/img.png') no-repeat 3px center;
    text-indent:2em;
}

Thx Joseph!

Post a Comment for "Using Chosen.js, How Would I Add Images To The Dropdown Items?"