let's suppose the browser rendered following page
<html>
...
<body>
<div id="partialContainer">
<script>
function saveItems(){
/* do somthing*/
}
</script>
<input type="button" id="btnTest" name="btnTest" value="Test" onclick="saveItems()"/>
</div>
</body>
</html>
after an AJAX call and change the "partialContainer" content using
$("#partialContainer").html(returnedMarkup)
saveItems function still remains in page and can get executed how can remove this function when markup get replaced to avoid name colissioning
<script>tag has script within itself or is including an external file - once the file is loaded and executed, it may as well have been inline, ie the answers are more or less the same whether you have inline script or external files.