Change button to disabled with jQuery based on condition?
<p>I just started learning jQuery and I'm watching video tutorials and trying to find different ways to accomplish things than in the video tutorial for learning purposes.  </p>

<p>I have two buttons, Day and Night. If I click Day, I want the Day button to be disabled and to load the day style sheet. If I click Night, I want to load the Night stylesheet and disable the Night button, but then enable the Day button.</p>

<p>Bear with me, here's my code, ihavenoideawhatimdoing.jpg. This isn't my full code, only posted relevant code.</p>

<pre><code>&lt;head&gt;
    &lt;link rel="stylesheet" href="day.css"&gt;
&lt;/head&gt;

&lt;button data-file="day"&gt;Day&lt;/button&gt;
&lt;button data-file="night"&gt;Night&lt;/button&gt;


&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"&gt;&lt;/script&gt;

&lt;script&gt;

    // self executing function
    (function() {
        var link = $('link');
        var button = $('button');
        var $this = $(this);

        if (button.data('file', 'day').click()) {
            link.attr('href', 'night.css');
            $this.attr('disabled');
            // code to enable night button, not sure how
        }
        else (button.data('file', 'night').click()) {
            link.attr('href', 'day.css');
            $this.attr('disabled');
            // code to enable the day button, not sure how
        }
    })();

&lt;/script&gt;
</code></pre>

<p>Also, another question.</p>

<pre><code>(function() {
    // code
})();
</code></pre>

<p>Will that function execute upon page load, I mean any code within that function? I think the guy in the video called it an autonomous function.</p>

<p>Thanks!</p>
