Monday, April 20, 2009

Using jQuery - Hide and Show Div

Write Less Do More .

In this post I'll show you how can hide and show a div using jquery.
First you should able to select your Div by jquery selectors.In this example I use the ID Selector .
Then Call .show() method to set display property of div from none to block , and .hide() to reverse it.




There is another way for this job , by using .toggle()  method your hidden div appears by first click and disappears by second click . you can use an optional parameter(speed)  by .toggle() method for animate your job . acceptable values for this parameter are "slow" , "fast" or a numeric value in millisecond . note that this optional parameter available for .show() and .hide() methods .

  

4 comments:

  1. Hi

    very good start, i hope you continue publishing interesting contents

    ReplyDelete
  2. sure... tell me whats your interest.
    thanks for your comment.

    ReplyDelete
  3. Hi
    I have a question.
    I'm new using JQuery, and, I want to do this...

    I have a table with 5 columns, I want to show column by column, first show the 1st column, after 5 seconds hide this column and show the 2nd column, and when I show the 5 column hide this and return to the 1st.

    If is more easy with divs I can change this columns for divs

    Could you help me please!

    ReplyDelete
  4. hi

    simple and easy to under stand

    http://csharpektroncmssql.blogspot.com

    ReplyDelete