View Full Version : erase Javascript the way innerHTML can Html

06-11-2007, 05:16 PM
Is there a way to erase the javascript between <div> tags; innerHTML="" does not erase the java.

06-12-2007, 04:20 AM
There shouldn't be any javascript between <div> tags, it belongs between <script> tags. It is rarely necessary to erase javascript though. You can just tell it to stop.

06-12-2007, 06:47 AM
HTML is set and unchanging. This means that the only way to change it and control it is to use javascript, such as with innerHTML.

Javascript, as programmable code, is great because you can use conditional statements (if, etc.) that allow for the code to act upon certain events or situations.

Javascript is generally run from an event, such as the page loading, the user clicking or typing, or time. As such, you can better choose this event, then you won't need to worry about deleting the actual code.

One great option here would be to use a function, so that the function is only executed when it's called, but isn't actually active in a div, etc.