<div class="bg">
<div class="grad"></div>
</div>
.bg {
position: relative;
height: 100px;
background: #f00;
}
.grad {
position: absolute;
top: 0; right: 0;
bottom: 0; left: 0;
background: linear-gradient(to bottom, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0) 100%);
}
var $inp = $(".test"),
reference = "Эй ты! А ну иди сюда! ";
function change (val) {
var ind = val.indexOf(reference);
if (ind !== 0) {
$inp.prop("value", reference);
}
}
$inp.on("input", function () {
var val = $(this).prop("value");
change(val);
});