I wrote this: when you start typing in the input, the span appears, but the fact is that if you then erase what you wrote, then this span remains, but you need to hide it. I wrote a condition inside the function, but something does not work, the span does not appear at all.
$('label.form-group').keyup(function() { $(this).children('span:first-child').show(); if ($('label.form-group input').value === '' || $('label.form-group input').value === this.defaultValue) { $('label.form-group>span:first-child').hide(); } }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <label class="form-group"> <span>×</span> <input class="form-control validate" id="email" type="text" required> </label>