Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts

    Colons in "id" tags give jQuery fits

    I was using an id name of "TEST:002:INPUT" on an entry field, which is technically valid, but I could not pull the value of the entry field using $("#TEST:002:INPUT").val(); -- was just returning "undefined". Once I changed the colons to underlines, I was able to pull the value with no problem.

    It only took me 2 hours to figure out what the problem was

  • #2
    Regular Coder Iszak's Avatar
    Join Date
    Jun 2007
    Location
    Perth, Western Australia
    Posts
    332
    Thanks
    2
    Thanked 58 Times in 57 Posts
    You need to escape the colon by using a double backslash.

    E.g.
    Code:
    $('#TEST\\:002\\:INPUT').val();
    Or simply use underscores like you did, but why compromise!

  • Users who have thanked Iszak for this post:

    Fumigator (08-05-2009)

  • #3
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Well dang I should have tried that, once I figured out the colons were a problem. By then, I just wanted the stupid thing to work so I was happy to just switch to underlines! But thanks for the tip


  •  

    Posting Permissions

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