Skip to content

Instantly share code, notes, and snippets.

@jefflab
Created October 9, 2010 02:40
Show Gist options
  • Save jefflab/617822 to your computer and use it in GitHub Desktop.
Save jefflab/617822 to your computer and use it in GitHub Desktop.
<select id="server">
<option value="localhost.zoodles.com">localhost.zoodles.com</option>
<option value="staging.zoodles.com">staging.zoodles.com</option>
<option value="www.zoodles.com">www.zoodles.com</option>
</select>
$( '#server' ).children( "[value='" + zoodles.server + "']" ).attr( 'class', 'cow' );
[<option value=​"localhost.zoodles.com" class=​"cow">​localhost.zoodles.com​</option>​]
$( '#server' ).children( "[value='" + zoodles.server + "']" ).attr( 'selected', 'true' );
[<option value=​"localhost.zoodles.com" class=​"cow">​localhost.zoodles.com​</option> ]
@jefflab
Copy link
Author

jefflab commented Oct 9, 2010

NM, this is what I was really trying to do:

$( '#server' ).val( 'www.zoodles.com' );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment