Cannot hide a selector, jQuery Uniform plugin
I'm using Uniform on select controls. I want to hide some of them so I do:
$('.selector').hide();
$.uniform.update('.selector');
The $.uniform.update('.selector')
is to sync the changes to uniform. But it's not working, the control just sta开发者_Go百科ys visible and no selectable.
Has anyone dealt with this before?
I've solved it wrapping the selector into a <div>
and hidding the <div>
, but I would like to know if anyone has a better solution.
$.uniform.update('selector');
is wrong, currently you are trying to find an element named selector, you want to look for the ID instead:
$.uniform.update('#selector');
if you got an element that has and ID of selector that is.
do you need to show the select box before? I tired
$('select').hide().uniform();
and to show it:
$('select').show().parent().show();
It may not be what you are looking for tho.
I have defined a function:
$.uniform.updateSelectors = function() {
$.uniform.update();
$('select').each(function() {
$(this).parent(".selector").toggle($(this).css("display") != "none");
});
};
Not pretty, but nicer than directly manipulating uniform divs, be
One solution is to target the tag element "<select>" and then the parent ".selector":
$('select').parent('.selector').hide();
精彩评论