Geeks With Blogs

@neh123us
  • neh123us T4 sould be your outsourcing strategy https://t.co/1ZceCUKWKE T4 - The Insource Code Monkey about 505 days ago
  • neh123us Had a need for Dynamic Views in MVC today. Wanted to use a Partial view on two different views with different ViewModels about 553 days ago

News Google

Nick Harrison Blog<Nick>.Next()
Chosen just may be the definitive jQuery plugin for cleaning up drop downs in your MVC applications.

Add this to your document ready event handler:
     $("select").chosen();

and enjoy the magic.   Everything else works seamlessly.   You don't have to worry about binding.   It still works as expected.

If you have wired up an onchange event handler, you have a little bit of work to do but not much and the look is quite impressive.

As an added bonus for long drop down lists, the default behavior gives you a searchable box at the top of the list.




Posted on Tuesday, January 15, 2013 11:57 AM Stylish musings | Back to top


Comments on this post: Have you seen Chosen?

# re: Have you seen Chosen?
Requesting Gravatar...
Wow great tip! That github link has some great examples. Thanks!
Left by Ben Barreth on Jan 15, 2013 12:37 PM

# re: Have you seen Chosen?
Requesting Gravatar...
You are welcome. I am always on the lookout for ways to replace some of the standard controls
Left by Nick on Jan 17, 2013 3:57 PM

# re: Have you seen Chosen?
Requesting Gravatar...
Hey Nick,

you'll be happy to hear I'm using "chosen" for a new category selection field in the GeeksWithBlogs admin tool! Thanks so much for this tip.

Ben
Left by Ben Barreth on Jan 22, 2013 1:08 PM

comments powered by Disqus

Copyright © Nick Harrison | Powered by: GeeksWithBlogs.net | Join free