views:

37

answers:

2

Hi, Is there a way to detect from where the text come (if it's not pure HTML) for example

document.write ('ok') will write ok somewhere in the page. But it doesn't show up in HTML, it's dynamic.

My problem is that I want to know where 'ok' comes from, when I have a long/complicated source of code.

Any idea?

+1  A: 

Search for 'ok' in your JavaScript files / look at what selector(s) it's within and search for those?

If those strategies don't help then I'm sure there's a JavaScript debugger that'll let you step through the code execution? That I expect would take a while though on your long/complicated source.

I don't think there's any other programmatic way for you to do this unfortunately.

Steve
I searched for the word, the problem 'the word is tr' exist more than once, hundred of times :)
Omar Abid
+1  A: 

You can override document.write and trace where the call is coming from. For example

document.write = function(arg) {
    console.trace()
}
stereofrog