title: Combining multiple JQuery UI statements to set up Button controls
body: <p>I'm pretty new to JQuery and JQuery-UI, but I'm having fun with it so far. My Javascript skills are a bit rusty, however, so some things are giving me a bit of a headache.</p>
  
  <p>I'm using Jquery UI to theme my site, and I have several buttons that I want to set up with the appropriate theme. Each button has a different icon, so I ended up with a bunch of statements that look like this:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $(function() {
          $('[id$="butFind"]').button({
              icons: {
                  primary: 'ui-icon-search'
              }
          });
      });
      $(function() {
          $('[id$="butUpdate"]').button({
              icons: {
                  primary: 'ui-icon-disk'
              }
          });
      });
      $(function() {
          $('[id$="butCancel"]').button({
              icons: {
                  primary: 'ui-icon-cancel'
              }
          });
      });
  // and so on for several more controls
  &lt;/script&gt;
  </code></pre>
  
  <p>I'm using the [id$=] ("ID ends with") selector as the controls that I'm theming are ASP.NET LinkButtons on a Content Page based off of a Master Page, and they get renamed when rendered to something like "ctl00_ContentPlaceHolder1_butFindSku". The ASP.NET markup for the buttons is pretty simple, and looks like:</p>
  
  <pre><code>&lt;asp:LinkButton ID="butUpdate" runat="server" Text="Update" 
     CommandName="Update"  /&gt;
  &lt;asp:LinkButton ID="butCancel" runat="server" Text="Cancel" 
     CommandName="Cancel" /&gt;
  </code></pre>
  
  <p>The multiple functions to theme the buttons and designate the appropriate icons seems rather awkward to me. I keep thinking that I should be able to either loop through some defined array of controls and icons, or tackle it in some other way that would make it easier for me in the future, particularly when I'm adding other controls to the page.</p>
  
  <p>Suggestions on better ways to set this up are appreciated! Thanks!</p>