treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Change color of a Label

  • Hi

    How can i change the background color of a label when the input is selected. The label in question is for a serie of radio input.

    Thanks a lot for any suggestion
  • onClick="if (this.checked){uno.className='item1'}else{uno.className='choise'}" :D
  • If you're using jQuery it's really easy.
    $('input').focus(function() {
    $(this).prev('label').css('color', 'green');
    }).blur(function() {
    $(this).prev('label').css('color', 'blue');
    });;
  • I can't see the option to change my labels,i'm iu suppose to enable something in order to change the label color.