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 4 of 4
  1. #1
    New Coder
    Join Date
    Aug 2002
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    check presence of an HTML element

    In Netscape6.0 and IE5.5 and greater, how do I check to see if a HTML element is present ?
    Say for example, I have a hidden field

    <input type="hidden" name="testField" value="something">

    So if the "testField" element is present I want my code to do something or else do something else.

    Any ideas ? Thanks in advance.

    Vik

  • #2
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    if (document.getElementsByName('testField').item(0)) {
    //it exists
    }

  • #3
    New Coder
    Join Date
    Aug 2002
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks. It works

  • #4
    New to the CF scene
    Join Date
    Aug 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    nice it works for me................thank u very much


  •  

    Posting Permissions

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