bratsun
10/19/2013 - 1:29 AM

Alter selects to grey out on default value and to light up on change

Alter selects to grey out on default value and to light up on change

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();
  });  
}