Well, without the code or a web-accessible page exhibiting the
problem, it's down to you now.
Use Firefox, with Firebug, and the DOM Inspector
Replace the alert with var assignments, eg
var za = document.getElementById('MyDiv');
var zb = $('#MyDiv');
var zc = zb.html();
var brk = 0;//set as break point
Break, and inspect vars; check DOM Inspector for #MyDiv (and that it's
unique)
Can't find #MyDiv?...
Break between (2) and (3), and between (3) and (4)
At breaks, inspect the DOM and check Firebug can Watch for, and find,
document.getElementById('MyDiv') and $('#MyDiv')
Still can't find it anywhere in the DOM?...
Break in (2) and check that it's actually in the returned data content
It has to exist at some point in all the above (eg, in the returned
data content?), and presumably start not-existing at some other point.
You're just going to have to narrow it down a bit more yourself.
On Apr 10, 7:12 pm, OhNoMrBill <[EMAIL PROTECTED]> wrote:
> Not stupid at all...if any one is doing that kind of question, sure it
> is me :)
>
> OK, so the code actually does this:
> 1) AJAX Request to server (get)
> 2) Success: ccontent is placed into <div id="someid"></div>
> 3) After content is is div, a scrubber runs and replaces links. <!--
> this works
> 4) Last a second scrubber tries to replace specific links with
> "redirect" links. <!-- this fails with undefined
>
> On Apr 10, 11:56 am, Wizzud <[EMAIL PROTECTED]> wrote:
>
> > Um, I realise this is probably a stupid question but has the named DIV
> > actually been added into the DOM at the time you do the jQuery lookup
> > on it?
> > (I know you've said that it displays on the page, but you don't show
> > what is actually being done to it to get it there)
>
> > On Apr 10, 6:41 pm, OhNoMrBill <[EMAIL PROTECTED]> wrote:
>
> > > Bouncing this one up. Getting kind of urgent. Can anyone tell me what
> > > the requirements are for accessing an element delivered in an HTML
> > > partial?
>
> > > All I am trying to do is attach an onclick to an href...after it comes
> > > down from the server.
>
> > > On Apr 10, 6:47 am, OhNoMrBill <[EMAIL PROTECTED]> wrote:
>
> > > > That is a bit cryptic, what do you mean by completed? The AJAX call
> > > > does successfully fire the call back for success.
>
> > > > It is after this call back completes, that a "scrubber" function is
> > > > called on the newly arrived div. Which, we are told is undefined.
>
> > > > So, the question is why would a div that displays in the browser not
> > > > be available by a reference such as:
>
> > > > alert($("#MyDiv").html()); or alert($("#MyDiv").text());
>
> > > > On Apr 9, 9:36 pm, Hamish Campbell <[EMAIL PROTECTED]> wrote:
>
> > > > > Is this an ajax call? 90% of these questions seem to come down to the
> > > > > call not being completed.
>
> > > > > On Apr 10, 1:38 pm, OhNoMrBill <[EMAIL PROTECTED]> wrote:
>
> > > > > > Yup, agreed. Tried that method too. Both return undefined. Any other
> > > > > > thoughts on why the div and/or it's contents are not showing up in
> > > > > > the
> > > > > > DOM?
>
> > > > > > On Apr 9, 4:49 pm, Wizzud <[EMAIL PROTECTED]> wrote:
>
> > > > > > > Your div does not actually contain any HTML, just text.
> > > > > > > Try ...
> > > > > > > alert($("#MyDiv").text());
>
> > > > > > > On Apr 9, 8:39 pm, OhNoMrBill <[EMAIL PROTECTED]> wrote:
>
> > > > > > > > I have an HTML partial coming back from a server that includes
> > > > > > > > a named
> > > > > > > > div (ex: <div id="MyDiv">blah</div>)
>
> > > > > > > > When I try to run the following on it, it shows the div as
> > > > > > > > empty:
>
> > > > > > > > alert($("#MyDiv").html());
>
> > > > > > > > I suspect the DOM is not aware of the retuned div (though, why
> > > > > > > > it
> > > > > > > > displays is then a huge mystery).
>
> > > > > > > > Can anyone clarify this for me? Maybe tell me how to tap the
> > > > > > > > DOM on
> > > > > > > > the shoulder with the newly returned div?
>
> > > > > > > > Thanks much!- Hide quoted text -
>
> > > > > > > - Show quoted text -- Hide quoted text -
>
> > > > > > - Show quoted text -