JSFiddle - React, Tailwind, and code Playground
by bearwolf
HTML
<script src="https://code.jquery.com/jquery-2.2.0.min.js"></script>
<form class="ab_form-col">
<input type="text" class="ab_input--rub">
<div class="js-ruble-before">
Что то...
</div>
</form>
<form class="ab_form-col">
<input type="text" class="ab_input--rub">
<div class="js-ruble-before">
Что то...
</div>
</form>
CSS
form{
height:50px;
margin-bottom: 20px;
position:relative;
}
.js-ruble-before{
position:absolute;
left:0;
bottom:0;
}
JavaScript
$(document).on("keyup", ".ab_form-col input.ab_input--rub", function() {
var _this = $(this);
_this.closest('.ab_form-col').find('.js-ruble-before').css({left: _this.val().length>=1 ? '210px' : '10px'});
});