SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Apr 2004
    Location
    canada
    Posts
    274
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Something Wrong With My jQuery

    I Am trying to get the value of a hidden field with an id of #testid and if it matches any one of the values (501,502,503,or505) in the query display a hidden div (#viewOthers), but the following code is not working:

    Code:
    if($("#testid").val() === "501", "502" , "503", "505"){
     $('#viewOthers').show();
    }
    Can someone help with this simple jQuery that has me boggled?

    Thanks!!

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Try using jQuery's inArray() method.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Bookmarks

Posting Permissions

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