JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" name="input" value="Type here">

JavaScript

jQuery( document ).ready( function( $ ) {

    var counter = 1;
    
	$( 'input' ).click( function(e) {
        counter ++;
        console.log( counter );
        if ( counter > 3 ) {
            $( 'input' ).attr( 'disabled', true );
        }
    } )
    
} );