Vidar
27 January 2009
jQuery filters and plugins, more love
I’m learning more about jQuery and its ingenious selectors. Let’s say you have a single select box with an option value of ‘red’. How do you set that one to selected?
The guys over at Scriptygoddess suggested a plugin. But why use a plugin when all you have to do is this:
$("select option:contains('red')")[0].selected = true
And you also gotta love the plugins. This is all I did to make this window have rounded corners:
$("#core").corner();
By now, in the project I’m working on while learning jQuery, I don’t have any inline javascript. Unobtrusiveness obtained.
« Back to posts Write a new comment