Skip to main content
2 of 2
replaced http://wordpress.stackexchange.com/ with https://wordpress.stackexchange.com/

This is a test about the code snippet function for this question on WPSE, there have not htis nice feature: https://wordpress.stackexchange.com/questions/194271/how-to-disabled-a-button-when-press-three-times/194272

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

    var counter = 1,
        element = 'input.edit';

    $( element ).click( function(e) {
        counter ++;
        // for control debugging in console
        console.log( counter );
        if ( counter > 3 ) {
            $( element ).attr( 'disabled', true );
        }
    } )

} );
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="text" name="input" class="edit" value="Click here">

bueltge
  • 2.4k
  • 12
  • 2