And, after executing the above code, the browser changes the content of the div, but inmediatly it exits the page.
How can I avoid that behavior?
Add a void(0); to the end and it will fix it.
One more solution:
When you copy and paste the
Copy the following into your address bar:
For me, in Chrome on Windows, the
A better solution
In Firefox: Developer Tools > Inspector > right click the HTML and choose "Edit as HTML".
In Chrome: Tools > More Tools > Developer Tools > Elements > right click the HTML and choose "Edit as HTML".
In IE: Developer Tools > HTML > Edit Icon (looks like a piece of paper with a pencil)