Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7588249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:52:34+00:00 2026-05-30T19:52:34+00:00

I’m pretty new to JQuery and JQuery-UI, but I’m having fun with it so

  • 0

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.

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:

<script type="text/javascript">
    $(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
</script>

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:

<asp:LinkButton ID="butUpdate" runat="server" Text="Update" 
   CommandName="Update"  />
<asp:LinkButton ID="butCancel" runat="server" Text="Cancel" 
   CommandName="Cancel" />

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.

Suggestions on better ways to set this up are appreciated! Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T19:52:36+00:00Added an answer on May 30, 2026 at 7:52 pm

    I would have suggested to associate the icons with the buttons using HTML5 data- attributes, but since you’re using ASP.NET web controls it will be more complicated than it’s worth.

    You can, however, store the id suffixes and their respective icons in an object literal, and use $.each() to iterate over it:

    $.each({
        butFind: "search",
        butUpdate: "disk",
        butCancel: "cancel"
    }, function(suffix, icon) {
        $("[id$='" + suffix + "']").button({
            icons: {
                primary: "ui-icon-" + icon
            }
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am reading a book about Javascript and jQuery and using one of the
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Seemingly simple, but I cannot find anything relevant on the web. What is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.