My Secret Life as a Spaghetti Coder
home | about | contact | privacy statement
I wanted to turn an HTML <select> element into an autocomplete. I also wanted to match on more than one attribute. So, I made jquery.autocomplete_from_select.js. Thoughts?

Hey! Why don't you make your life easier and subscribe to the full post or short blurb RSS feed? I'm so confident you'll love my smelly pasta plate wisdom that I'm offering a no-strings-attached, lifetime money back guarantee!


Comments
Leave a comment

Have you checked out Chosen or Select2? (I prefer Select2.)

Posted by James Moberg on Feb 25, 2013 at 02:47 PM UTC - 6 hrs

Thanks James, yes I've seen them and they are both awesome!

However, they have a little too much UI chrome for what I was looking for: they'd have looked out of place in the app I was working on that led to this little "project". Rather than try to style them appropriately, it seemed better to just use what I had with jQuery UI, since it already fit in well.

Also, the file I wrote is less than 4 KB without minification. In this app, asset size isn't a huge consideration, but it might be in others.

Posted by Sammy Larbi on Feb 26, 2013 at 07:06 AM UTC - 6 hrs

I dropped the demo script + markup into an existing framework and it didn't working right. (Win8-64, Chrome, jQuery 1.8.3, jQuery UI 1.9.1) It displays a text field. Typing in the value didn't do anything. Reattempting entry would show a drop-down with all options, but typing in "abc" didn't reveal any results and pressing tab cleared out the entry since it didn't match anything.

Will you be posting an simple online demo? I like online demos because I can verify that the script works and does what I think it should do before I download it to try it out. (Some scripts break with newer versions of jQuery.)

Posted by James Moberg on Feb 26, 2013 at 08:57 AM UTC - 6 hrs

Sure thing. I'll put something in there later today. I did have it clear the entry on purpose if there is no match, though it's easy enough to change that if you're interested.

Posted by Sammy Larbi on Feb 26, 2013 at 09:05 AM UTC - 6 hrs

Ok, there were a couple of bugs in what I posted to github -- thanks for finding them!

Example is up at http://codeodor.github.com/jquery.autocomplete_fro..., the code has been updated, as has the README.

Posted by Sammy Larbi on Feb 26, 2013 at 10:31 AM UTC - 6 hrs

Leave a comment

Leave this field empty
Your Name
Email (not displayed, more info?)
Website

Comment:

Subcribe to this comment thread
Remember my details
Google
Web CodeOdor.com

Me
Picture of me

Topics
.NET (19)
AI/Machine Learning (14)
Answers To 100 Interview Questions (10)
Bioinformatics (2)
Business (1)
C and C++ (6)
cfrails (22)
ColdFusion (78)
Customer Relations (15)
Databases (3)
DRY (18)
DSLs (11)
Future Tech (5)
Games (5)
Groovy/Grails (8)
Hardware (1)
IDEs (9)
Java (38)
JavaScript (4)
Linux (2)
Lisp (1)
Mac OS (4)
Management (15)
MediaServerX (1)
Miscellany (75)
OOAD (37)
Productivity (11)
Programming (168)
Programming Quotables (9)
Rails (31)
Ruby (67)
Save Your Job (58)
scriptaGulous (4)
Software Development Process (23)
TDD (41)
TDDing xorblog (6)
Tools (5)
Web Development (7)
Windows (1)
With (1)
YAGNI (10)

Resources
Agile Manifesto & Principles
Principles Of OOD
ColdFusion
CFUnit
Ruby
Ruby on Rails
JUnit



RSS 2.0: Full Post | Short Blurb
Subscribe by email:

Delivered by FeedBurner