开发者

jquery and hiding labels

I have a form which has a set of fields which I would like hidden on initial page load, I have done this using jquery) which works however in Internet Explorer the padding and height of these hidden fields is still visible so I'm left with huge spacing everywhere.

Any idea how I can get 开发者_开发百科jquery to hide this padding? Thanks


Wrap the fields in a div and hide the div on page load.


Since you can't alter the layout, try wrapping the content you want to hide in a new DIV using jquery's .wrap() and then hide the new DIV.

    $('#ExistingElement').wrap('<div class="newDivToHideStuff" />');
    $('.newDivToHideStuff').hide();


whatever you want to hide, you could wrap it in a div and hide that whole div altogether, no ?


If the element is hidden, so will its padding and height.

This is unless you are using visibility: hidden. Don't do that - use hide() (which is display: none).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜