You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 16, 2021. It is now read-only.
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
The text was updated successfully, but these errors were encountered:
I have also come across this problem and have had to implement a hack. But the problem is that sometimes you want classes to be inherited, and sometimes you don't... If they are classes used for styling, it would be important to inherit them. If the classes are used as selectors to implement some functionality, it may not be a good idea... so how do you decide?
One solution I implemented was to take a list of all classes and extract a list of forbidden functional classes using regular expressions, then adding those classes to the wrapper
. I don't see any other way of getting around this...
I've started with a rewrite of Uniform to address many concerns. This last comment in particular poses a challenge with my new scheme - I plan on copying all classes to the wrapper. I figure that if you want to style the element, your CSS would use input.some-class instead of .some-class. If you are targeting an element, you could use $('input.some-class') or $('.some-class').not('.uniformjs').
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
The text was updated successfully, but these errors were encountered: