Show more than 10,000 characters in a JavaScript Alert [duplicate]

Possible Duplicate:
javascript object max size limit at 10000 chars

I want to check whether html source contains a specified string, but I'm only getting 10,000 characters (in alert box)

var str=document.documentElement.innerHTML;
if(str.indexOf("abcxyz") !== -1)

How can I fix that?



If you need to display a huge string in alert boxes, I guess you could split it into 10,000-character chunks and display them in order. Alternatively, just use console.log to print it out.

And is there a better way to detect a "onClick" event?

Better than what? JavaScript events will bubble up to the top containing element (unless some element in the chain calls stopPropagation()), so an easy way to detect click events would be to attach a click handler to document.body:

document.body.onclick = function() { alert('Click!'); }


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.