Skip to content

Instantly share code, notes, and snippets.

@jarib
Created February 20, 2009 15:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jarib/67496 to your computer and use it in GitHub Desktop.
Save jarib/67496 to your computer and use it in GitHub Desktop.
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>jquery test</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
(function ($) {
function init(){
$(".editLink").click(function(event){
var scriptTag = "<scri" + "pt> function update() { return 0; } </s" + "cript>";
$('#script').replaceWith(scriptTag);
$('#content').append(typeof(update));
event.preventDefault();
return false;
});
}
$(document).ready(init);
})(jQuery);
</script>
</head>
<body id="jquery" onload="">
<div id="script"></div>
<a href="http://www.google.com" class="editLink">add function</a>
<div id="content">typeof update: </div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment