Skip to content

Instantly share code, notes, and snippets.

@wyanez
Created March 22, 2013 17:44
Show Gist options
  • Save wyanez/5223271 to your computer and use it in GitHub Desktop.
Save wyanez/5223271 to your computer and use it in GitHub Desktop.
Test Extend DOM Element
<html>
<head>
<script>
Element.prototype.html = function (value){
if (value){
this.innerHTML=value;
}
else {
return this.innerHTML;
}
}
function $(elemento){
return document.getElementById(elemento);
}
</script>
</head>
<body>
</body>
<div id="mydiv">Este es un div</div>
<script>
alert( $('mydiv').html());
$('mydiv').html('Probando');
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment