I need help understanding this script.
Im following a tutorial and the person did not explain it well enough and Im pretty lost!
So if you can just tell me what jQuery is doing!
- <body>
- <h1>My Website</h1>
- <button data-file="day">Day</button>
- <button data-file="night">Night</button>
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>
- <script>
- (function() {
- var link = $('link');
- $('button').on('click',function(){
- var $this =$(this),
- stylesheet = $this.data('file');
- link.attr('href',stylesheet + '.css');
- $this
- .siblings('button')
- .removeAttr('disabled')
- .end()
- .attr('disabled','disabled');
- });
- })();
- </script>
- </body>