How to change css display none or block property using Jquery?
相关问题
- How to fix IE ClearType + jQuery opacity problem i
- jQuery add and remove delay
- Include empty value fields in jQuery .serialize()
- Disable Browser onUnload on certain links?
- how to get selected text from iframe with javascri
use this
or
The correct way to do this is to use
show
andhide
:An alternate way is to use the jQuery css method:
In my case I was doing show / hide elements of a form according to whether an input element was empty or not, so that when hiding the elements the element following the hidden ones was repositioned occupying its space it was necessary to do a float: left of the element of such an element. Even using a plugin as dependsOn it was necessary to use float.
.hide() does not work in Chrome for me This works for hidding:
for hide:
for show:
If the display of the div is block by default, you can just use
.show()
and.hide()
, or even simpler,.toggle()
to toggle between visibility.