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

  • Home
  • SEARCH
  • 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 4086372
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:43:02+00:00 2026-05-20T18:43:02+00:00

Greetings, I am restyling the select element with HTML5 and jQuery. I can successfully

  • 0

Greetings,

I am restyling the select element with HTML5 and jQuery. I can successfully create one dropdown with a .js file dedicated to the element, but I need help on populating the page with multiple instances of this element.

The select element can be summarized as this:

<form>
<select name="fancySelect" class="makeMeFancy">
<option value="0" selected="selected" data-skip="1">Choose Your Location</option>
<option value="1" data-html-text="United States">United States</option>
</select>
</form>

The js is more complex and seeks to hide the select element and replace it.
Briefly:

var select = $('select.makeMeFancy');
var selectBoxContainer = $('<div>',{
    width       : select.outerWidth(),
    className   : 'tzSelect',
    html        : '<div class="selectBox"></div>'
});

var dropDown = $('<ul>',{className:'dropDown'});
var selectBox = selectBoxContainer.find('.selectBox');

It then creates css styles for this element further down the script.

My question is how do I maintain this one javascript document for multiple select elements. Is it possible with one main variable and multiple select classnames i.e.

var select =$('select.makeMeFancy');
var selectBoxContainer = $('<div>',{
width   : select.outerWidth(),
className   : 'tzSelect','tzSelectb','tzSelectc'
html        : '<div class="selectBox"></div>'

HTML example is available at: select restyling example updated: SOLVED

I have 3 elements inline, and as you can see it pulls the code into the very last select element and groups them altogether.

Sorry for the sloppy description, I think this should be everything.

The original dropdown was created by Turtorial Zine over at TutorialZine “Making better select elements”

  • 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-20T18:43:03+00:00Added an answer on May 20, 2026 at 6:43 pm

    They actually have converted this to a plugin on their website. See here. No need to reinvent the wheel.

    Edit
    According to the tutorial:

    You can use this plugin by simply
    dropping the tzSelect folder
    (available from the download button
    above) into your project root, and
    including jquery.tzSelect.css and
    jquery.tzSelect.js in your HTML
    documents.

    Example Code (From Tutorial)

    $(document).ready(function(){
    
        $('select.makeMeFancy').tzSelect({
            render : function(option){
                return $('<li>',{
                    html:   '<img src="'+option.data('icon')+'" /><span>'+
                            option.data('html-text')+'</span>'
                });
            },
            className : 'hasDetails'
        });
    
        // Calling the default version of the dropdown
        $('select.regularSelect').tzSelect();
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Greetings, I need a way (either via C# or in a .bat file) to
Greetings, I have a particular object which can be constructed from a file, as
Greetings, The VBA code below will create an Excel QueryTable object and display it
Greetings, currently I am refactoring one of my programs, and I found an interesting
Greetings, Here is my SConstruct file: env = Environment() env.Append(CCFLAGS=['-g','-pg']) env.Program(target='program1', source= ['program1.c']) Also
Greetings, I have a complicated scenario to handle. I have a wsdl file which
Greetings, I am changing the width of an element which serves as a bar
Greetings All, I need to optimize a RegEx I am using to parse template
Greetings, I'm trying to find a way to 'unbind' a socket from a particular
Greetings. I'm looking for a way to parse a number of XML files in

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.