title: Date Picker Not Displayed When Clicking On Calendar
body: <p>I have input fields which are date pickers and at present, work fine when you click in the field.  But I have been asked that the calendar should also display when a user clicks on the calendar but this is the bit I cant get to work.</p>
  
  <p>I am using a textbox extension and my code is:</p>
  
  <pre><code>public static MvcHtmlString CalandarTextBox(this HtmlHelper htmlHelper, string prefix, string name, object value, object htmlAttributes)
      {
  
          TagBuilder tagBuilder = new TagBuilder("input");
          tagBuilder.MergeAttributes(new RouteValueDictionary(htmlAttributes));
  
          string template = "";
          template += "&lt;div class=\"input-group input-group-IE7\"&gt;";
          template += "   &lt;input class=\"form-control\" type=\"text\" name=\"{0}\" id=\"{0}\" value=\"{1}\" {2}";
          template += "   &lt;div class=\"input-group-addon input-group-addon-IE7\"&gt;&lt;i class=\"{3}\"&gt;&lt;/i&gt;&lt;/div&gt;";
          template += "&lt;/div&gt;";
          MvcHtmlString TextBox = new MvcHtmlString(
              String.Format(template, name, value, tagBuilder.ToString(TagRenderMode.Normal).Replace("&lt;input ", " "), prefix)
              );
  
          return TextBox;
      }
  </code></pre>
  
  <p>My code in my view for these fields is then:</p>
  
  <pre><code>template.Nvc.Add("[!FromDate]",  Html.CalandarTextBox("glyphicon glyphicon-calendar", "FromDate", fromDateValue, new { @class = "form-control" }).ToHtmlString());
  </code></pre>
  
  <p>And finally my Javascript for the field is:</p>
  
  <pre><code>    $("#FromDate").click(function () {
          $("#Months").val(0);
      });
  
      $("#FromDate").datepicker({
          dateFormat: 'dd/mm/yy',
          changeMonth: true,
          changeYear: true
      });
  </code></pre>
  
  <p>As I said the above, displays the calendar when I click on the input field but NOT if I click on the calendar at the end of the input field.</p>
  
  <p>How do I do this.</p>