INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Dropdown items not visible after jquery show and hide

Dropdown items not visible after jquery show and hide

(OP)
I have a dropdownlist that is filled with items.

I show and hide the div surrounding the dropdownlist using the following code .

divPCSelection.Style.Add("display", bo.User ? "none" : "normal");

This hides and show fine.

When I do a post back and look at the pages view source, the div shows the style display:none. The dropdown also shows all the items in the dropdown.

If then do a jquery "show" of the div, the div shows but the dropdown is now empty.

The jquery code is:

CODE

function TogglePCSelection() {
         if ($("#<%=chkUser.ClientID%>").is(":checked")) {
            $("#<%=divPCSelection.ClientID%>").hide();
         }
         else {
            $("#<%=divPCSelection.ClientID%>").show();
         }
      } 

It doesn't seem to actually be empty as I can do a normal postback and the data is now back in the dropdownlist.

What is happening here?

Thanks,

Tom


RE: Dropdown items not visible after jquery show and hide

"normal" is not a valid option for "display", use inline or block.

Start to debug. First, remove that code and have the ddl always show when the page loads so you can be sure the ddl has items.
Then, test your javascript/jquerycode by checking and unchecking the checkbox to make sure the show/hide works correctly.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close