Skip to content
This repository was archived by the owner on Jan 6, 2026. It is now read-only.

Classes on checkboxes, radio buttons, and selects don't get pulled onto the wrapping divs #355

@roubaobaozi

Description

@roubaobaozi

div.selector, div.checker, div.radio don't take on the classes of the inputs/selects they wrap, but often adding a class is necessary for certain styling.

I wrote this (all inputs, selects and textareas within .uniform have uniform() run on them):

$('.uniform input:checkbox[class]').each(function() {
var checkboxClasses = $(this).attr('class');
$(this).parent().parent('div.checker').addClass(checkboxClasses);
});
$('.uniform input:radio[class]').each(function() {
var radioClasses = $(this).attr('class');
$(this).parent().parent('div.radio').addClass(radioClasses);
});
$('.uniform select[class]').each(function() {
var selectClasses = $(this).attr('class');
$(this).parent('div.selector').addClass(selectClasses);
});

Which does the job for me. I don't know if there's a better way that could be written. Just thought someone might like it, or know how to .. make this available for all uniform.js users.

Hope this is useful.

Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions