|
-
Dec 13th, 2018, 08:24 AM
#1
Thread Starter
Don't Panic!
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
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...
-
Dec 13th, 2018, 08:28 AM
#2
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
-
Dec 13th, 2018, 10:54 AM
#3
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
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
-
Dec 13th, 2018, 11:14 AM
#4
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.
-
Dec 13th, 2018, 11:15 AM
#5
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.
-
Dec 17th, 2018, 08:33 AM
#6
Thread Starter
Don't Panic!
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
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|