jQuery code not working on my local machine
<p>Below code works fine on <a href="http://jsfiddle.net/saQTw/2/" rel="nofollow">http://jsfiddle.net/saQTw/2/</a></p>

<p>for some reason it doesnt work on my local machine, i am not sure where i am making the mistake. Need an expert eye to look what i am doing wrong in this code.</p>

<p>Code which i got from the stackoverflow is support to populate the select list with dates
but i cant make it work on my local machine. </p>

<pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
    &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
    &lt;head&gt;
    &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
    &lt;title&gt;Untitled Document&lt;/title&gt;
    &lt;script  type="text/javascript"
        src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"&gt;
    &lt;/script&gt;
    &lt;link href="css.css" rel="stylesheet" type="text/css" /&gt;
    &lt;script&gt;
    function pad(n){return n&lt;10 ? '0'+n : n}
    var date = new Date();
    var selectElement = $('&lt;select&gt;'), optionElement;
    for (var count =0; count &lt; 90; count++){
        formattedDate = pad(date.getUTCDate()) + '-' + pad(date.getUTCMonth()+1) + '-' +  date.getUTCFullYear();
        optionElement = $('&lt;option&gt;')
        optionElement.attr('value',formattedDate);
        optionElement.text(formattedDate);
        selectElement.append(optionElement);
        date.setDate(date.getDate() + 1);
    }
    $('#ddDate').append(selectElement);
    &lt;/script&gt;
    &lt;/head&gt;

    &lt;body&gt;

    &lt;div id="ddDate"&gt; &lt;/div&gt;
    &lt;/body&gt;
    &lt;/html&gt;
</code></pre>

<p>I tried jQuery version 1.6 also it does not work</p>

<p>Solution for the above problem:</p>

<pre><code>&lt;script&gt;
$(function(){
    function pad(n){return n&lt;10 ? '0'+n : n}
    var date = new Date();
    var selectElement = $('&lt;select&gt;'), optionElement;
    for (var count =0; count &lt; 90; count++){
        formattedDate = pad(date.getUTCDate()) + '-' + pad(date.getUTCMonth()+1) + '-' +  date.getUTCFullYear();
        optionElement = $('&lt;option&gt;')
        optionElement.attr('value',formattedDate);
        optionElement.text(formattedDate);
        selectElement.append(optionElement);
        date.setDate(date.getDate() + 1);
    }
    $('#ddDate').append(selectElement);
});
    &lt;/script&gt;
</code></pre>
