JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" id="txt1" name="type_name" value="Value1-" >

JavaScript

$('#txt1').on('keyup',function(){
    console.log($(this).val().substr( 0 , 7)) ;
    if($(this).val().substr( 0 , 7) != "Value1-") {
        $(this).val('Value1-');
    }
});