Skip to content

Instantly share code, notes, and snippets.

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 ntreadway/1980988 to your computer and use it in GitHub Desktop.
Save ntreadway/1980988 to your computer and use it in GitHub Desktop.
Style your HTML Select Field using CoffeeScript and JQuery
$(document).ready ->
unless $.browser.opera
$("select.option_id").each ->
title = $(this).attr("title")
title = $("option:selected", this).text() unless $("option:selected", this).val() is ""
$(this).css(
"z-index": 10
opacity: 0
"-khtml-appearance": "none"
).after("<span class=\"select\">" + title + "</span>").change ->
val = $("option:selected", this).text()
$(this).next().text val
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment