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)
{
alert(str);
}
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!'); }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With