You cannot do this using pure CSS, but using jQuery, you can add these few simple lines to your code:
$( ".form-control" ).focus(function() { $(this).prev('.input-group-addon').removeClass().addClass('input-group-addon-focus'); $(this).next('.input-group-addon').removeClass().addClass('input-group-addon-focus'); }); $( ".form-control" ).focusout(function() { $(this).prev('.input-group-addon-focus').removeClass().addClass('input-group-addon'); $(this).next('.input-group-addon-focus').removeClass().addClass('input-group-addon'); });
If your addon is not placed before or after the control EXACTLY, you can wrap the control and addon in a shell and change the code using
.parent('.wrapperClass').children('.input-group-addon')
Full code: JSFiddle example
source share