Text
jQuery can’t get some properties from a hidden element
Today I founded an error with a plugin called Stylish Select (for customized selects). My select was contained in a hidden content (for filtering searches) and the plugin didn’t customize correctly my combo element. Its height was 0. And what’s the problem?, all its calculated operations are wrong. What’s the solution?, simply. Just find that hidden element (respect a concrete element):
var elToShow = $(this).parents(":hidden:last");
And show it:
if (elToShow.html() != null && elToShow.html().trim()){ // not empty
var hideElement = 1;
elToShow.show();
}
Calculate all its dimensions and immediately, hide it again:
if (hideElement) elToShow.hide();And that’s all. P.S.: I forked my own version of that plugin. You can download it, here.
-
hernandezext liked this
-
eisenhower402 liked this
-
harriers65gh liked this
-
university26fg liked this
-
keynotetis8 liked this
-
gloria2fg liked this
-
heatheryi982 liked this
-
fergusonicd890 liked this