JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" id="txt1" name="type_name" value="Value1-">
JavaScript
$('#txt1').on('keyup',function(){
var str=$(this).val();
var newstr = str.substring(0, 7);
if(newstr != "Value1-")
{ // alert($(this).val());
//$(this).val("");
// alert($(this).val());
$(this).val("Value1-");
}
});