title: Setting Value of Label Client Side
body: <p>I have a web page that has a Folder Picker pop up. It allows the user the select a folder on the website, and then track changes to its contents.</p>
  
  <p>I need to pass the value from the pop-up, which is returned to me in JavaScript, and pass that to a server side method.</p>
  
  <p>AJAX is not available for this, as I'm working with SharePoint.</p>
  
  <p>I get the data I need from a callback in JavaScript, but if I try to set $(control).text(), this doesn't work.</p>
  
  <p>Can I set the value of a label (rendered as a span) somehow and pass that back onClick?</p>
  
  <p><strong>Current working Code:</strong></p>
  
  <pre><code>$('.tile').on("click", ".LibraryPickerInitiator", function () {
      var hiddenField = $(this).siblings('[type=hidden]');
      var callback = $.proxy(function (s) { this.val(s); }, hiddenField);
      LaunchPickerTreeDialog('CbqPickerSelectListTitle', 'CbqPickerSelectListText', 'websLists', '', '/', '', '', '', '/_layouts/images/smt_icon.gif', '', callback, '', '');
  });
  </code></pre>
  
  <p>Markup:</p>
  
  <pre><code>&lt;div id="WebSettings" class="WebSettings" runat="server"&gt;
      &lt;div class="LibraryPickerInitiator"&gt;Pick a Library&lt;/div&gt;
      &lt;asp:HiddenField ID="HiddenField1" runat="server" /&gt;
      &lt;asp:Label ID="TreePickerLabel" CssClass="PickerPlaceHolder" runat="server" Text="No List Selected"&gt;&lt;/asp:Label&gt;
      &lt;asp:Button ID="SubmitList" runat="server" Text="Get List Data" onclick="SubmitList_Click" /&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Event:</p>
  
  <pre><code>protected void SubmitList_Click(object sender, EventArgs e)
  {
      string pickerData = HiddenField1.Value;
  }
  </code></pre>