0

I have some SCSS code here:

  .location {
    animation-delay: 80ms;
    position: relative;
    &:before {
      font-family: "FontAwesome";
      font-size: 24px;
      content: "\f041";
      position: absolute;
      left: 4px;
      top: 12px;
    }
    input {
      text-indent: 28px;
    }
  }

I want to change the text color of .location:before, ON .location input:focus. Is this even possible with pure css?

Any help is appreciated :)

1 Answers1

0

Try this

$(document).ready(function() {
  $('.location input').on('focusin', function(event) {

    $('.location').addClass('text-red')

  }).on('focusout', function(event) {

    $('.location').removeClass('text-red')

  });
})
.location {
  animation-delay: 80ms;
  position: relative;
}

.location:before {
  content: "Hi....";
  //font-family: "FontAwesome";
  //font-size: 24px;
  //content: "\f041";
  position: absolute;
  left: 4px;
  top: 20px;
}

input {
  text-indent: 28px;
}

.text-red:before {
  color: red;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="location">
  <input type="text" name="">
</div>
Codesigner
  • 578
  • 3
  • 16