Created
March 22, 2013 17:44
-
-
Save wyanez/5223271 to your computer and use it in GitHub Desktop.
Test Extend DOM Element
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
<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