Results 1 to 2 of 2

Thread: should i use a SWITCH or IF-ELSE IF-ELSE statement? or neither?

  1. #1
    Join Date
    Jan 2008
    san francisco, california

    should i use a SWITCH or IF-ELSE IF-ELSE statement? or neither?

    I have 2 select-lists (#list1 and #list2) each of which trigger show/hide events on divs associated with them.
    I am using 2 different switch statements, one for each list + corresponding divs. This is working fine using jquery.
    Please see my: Test Page a

    I'd like #list2 to also trigger show/hide events on some of the #list1 divs, but only if the #list1 divs are already shown.
    Please see my: Test Page B

    It feels like the IF/ELSEIF/ELSE statement in my Test Page B ought to work but doesnt. Which may boil down to a simple syntax issue or a larger structural/conceptual problem.

    Any thoughts, comments & improvements are welcome.

  2. #2
    Join Date
    Jul 2008
    urbana, il
    It's simpler to hide them all each time, and then simply show the one you need...
    it's going to be a lot more maintainable as well; try to avoid hard-coding repetition.
    Create, Share, and Debug HTML pages and snippets with a cool new web app I helped create: pagedemos.com

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center