Skip to content

Instantly share code, notes, and snippets.

@pavelz
Created May 1, 2012 13:44
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 pavelz/2568007 to your computer and use it in GitHub Desktop.
Save pavelz/2568007 to your computer and use it in GitHub Desktop.
basic code to tie select element to display different dom elements
jQuery ->
$(document).ready ->
element = $('#item_type')
element.bind 'change', ->
el = $('#item_type')[0]
$('.type_edit').css('display','none')
$('.' + el.options[el.selectedIndex].text.toLowerCase()).css('display','block')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment