empty string becomes default value

In this example below you will see how to do a empty string becomes default value with some HTML / CSS and Javascript

Thumbnail
This awesome code was written by machenmusik, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright machenmusik ©
  • HTML
  • CSS
  • JavaScript
    <script src="https://rawgit.com/aframevr/aframe/master/dist/aframe-master.js"></script>

<script>
AFRAME.registerComponent('whydefaultvalue', {
  schema: {type:'string', default:'default'},
  init: function() { 
    this.el.setAttribute('text', 'align:center; color:white;wrapCount:10;value:' + this.data); 
  }
});
</script>

<a-scene debug>
  <a-plane position="0 1 -2" color="#F00" whydefaultvalue=""></a-plane>
</a-scene>


/*Downloaded from https://www.codeseek.co/machenmusik/empty-string-becomes-default-value-XRjYBO */
    


/*Downloaded from https://www.codeseek.co/machenmusik/empty-string-becomes-default-value-XRjYBO */
    

Comments