Solved

style a dropdownlist to not show the down arrow icon on the right?

Posted on 2011-09-20
3
353 Views
Last Modified: 2012-06-27
Is there a way through jquery / css to style a dropdownlist so that it appears as a text label?

See my mock-up.

 ddl
0
Comment
Question by:knowlton
3 Comments
 
LVL 3

Accepted Solution

by:
mykde earned 250 total points
ID: 36568351
Unfortunately browsers allow limited skinning of select boxes.  

So I recommend using jQuery to change a select box into a text box and a unorded list for the dropdown.  When a user clicks on the text box it will display the list below the textbox, just like a regular select box, but it’s easier to style.

Here is a link to a very detailed example. http://www.devirtuoso.com/2009/08/styling-drop-down-boxes-with-jquery/
0
 
LVL 82

Assisted Solution

by:leakim971
leakim971 earned 250 total points
ID: 36569092
may help : http://jsfiddle.net/9UFge/

<span>Select a State</span>
<select>
    <option value="">Select a State</option>
    <option value="AL">Alabama</option>
    <option value="CA">California</option>
</select>

Open in new window


    $("span").click(function() {
        $("select").css("display","block");
    })
    $("select").change(function() {
        $("span").html( $("option:selected",this).text() );
        $("select").css("display","none");
    }) 

Open in new window

0
 
LVL 5

Author Closing Comment

by:knowlton
ID: 36575244
thx
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

There are a couple ways to attach a JavaScript function to dynamically created elements. You can make a new script for each element as it’s created or you can use delegation. Delegation allows a single script that is added at page creation to mat…
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now