Created
October 19, 2013 01:29
-
-
Save bratsun/7050669 to your computer and use it in GitHub Desktop.
Alter selects to grey out on default value and to light up on change
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function webformSelect() { | |
$('.webform-component-select').each(function() { | |
var t = $(this); | |
var text = t.find('label').text().replace(' *',''); | |
t.find('option:first').addClass('first').text('Select ' + text); | |
t.find('select').live('change', function () { | |
if($(this).find('option:selected').hasClass('first')) $(this).addClass('idle'); | |
else $(this).removeClass('idle'); | |
}); | |
t.find('select').change(); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment