Results 1 to 6 of 6

Thread: HTML (Dynamically added) not visible to document or JQuery

  1. #1

    Thread Starter
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    HTML (Dynamically added) not visible to document or JQuery

    Hi

    For the company I work for, I have some HTML being generated and inserted via AJAX (I think).
    Problem is that the new elements cannot be found via document.getElementByID nor JQuery $("#nameofnewelement").

    Browser is showing them though.

    Is there a way to refresh the document and/or JQuery?

    Regards

    Vince

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: HTML (Dynamically added) not visible to document or JQuery

    As long as the DOM is being updated properly, and if it's being displayed, it sounds like it is, then the only reasons I can think of that the getElementByID or JQuery wouldn't work is because they are executing before the DOM is updated, or the ID isn't correct.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Re: HTML (Dynamically added) not visible to document or JQuery

    If the are inserting to asp.net then if they are using master pages, then there is a chance you won't get the elements that easy.
    Again, if it is asp.net
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  4. #4
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: HTML (Dynamically added) not visible to document or JQuery

    Remember that ID's must be unique on a page. You can certainly put up two elements with the same ID - but don't expect them to work.

    btw - the jQuery doesn't need to be updated - it's looking at the DOM tree using standard JavaScript functions.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  5. #5
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: HTML (Dynamically added) not visible to document or JQuery

    Remember that ID's must be unique on a page. You can certainly put up two elements with the same ID - but don't expect them to work.

    btw - the jQuery doesn't need to be updated - it's looking at the DOM tree using standard JavaScript functions.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  6. #6

    Thread Starter
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: HTML (Dynamically added) not visible to document or JQuery

    Its on Tomcat (Jsp).
    It looks like the browser is working, but js scripts and the new dom elements cannot be seen after the ajax call. Which is strange. I'll keep going, thanks for the suggestions

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

Posting Permissions

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



Click Here to Expand Forum to Full Width