Created
September 22, 2009 12:55
-
-
Save christianhager/191043 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="widget"></div> | |
<script src="http://yourapp.com/widget.js?element=widget"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
the code outside the function(container) works nice | |
what do I do wrong inside? | |
*/ | |
var newDiv = document.createElement('DIV'); | |
newDiv.innerHTML = "<p>a paragraph outside</p>"; | |
document.getElementById('widget').appendChild(newDiv); | |
(function(container){ | |
var newDiv = document.createElement('DIV'); | |
newDiv.innerHTML = "<p> a paragraph inside</p>"; | |
$(this).appendChild(newDiv); | |
/* var list = new Element('ul'); | |
list.insert(new Element('li').update('foo')); | |
alert('inside does not work'); | |
container.update(list);*/ | |
})($('widget')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment