flurin-d
1/26/2016 - 7:13 AM

Move input-placeholder out on focus

Moves the placeholder of an input to a different position as soon as at least one character is entered.

/* MOVE LABEL ON INPUT
/----------------------------*/
$('input.checkout').on('keyup', function() {
  var name = $(this).attr("name");
  var value = $(this).val();
  
  if (value.length) {
  	$("label[for=" + name + "]").addClass('phlabel');
  } else {
  	$("label[for=" + name + "]").removeClass('phlabel');
  }
});