Skip to content

Instantly share code, notes, and snippets.

@bennybennet
Created March 17, 2013 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bennybennet/5183573 to your computer and use it in GitHub Desktop.
Save bennybennet/5183573 to your computer and use it in GitHub Desktop.
$('select.bb-styled').each(function(){
var title = $(this).attr('title');
if( $('option:selected', this).val() != '' ) title = $('option:selected',this).text();
var idName = $(this).attr('id') + '_container';
$(this).before('<div class="bb-styled-container" id="' + idName + '"></div>')
$('#' + idName).append(this);
$(this)
.css({'opacity':0})
.after('<span class="bb-styled">' + title + '</span>')
.change(function(){
val = $('option:selected',this).text();
$(this).parent().find('span').text(val);
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment