JSFiddle - React, Tailwind, and code Playground

HTML

<div id="clignotant" style="background-color:#FF6633;width:500px;
height:100px;line-height:100px;text-align:center;">
    Usage: blink(selector, blink_speed, iterations)
</div>
<br />
<input id="mybutt" type="button" value="Make Blink">

JavaScript

var init = 0; //used to make text blink on page load and still permit user click

$('#mybutt').click(function() {
    var num = prompt("Number of blinks?", "15");
    var spd = prompt("Blink speed? (1000 equals one second delay)", "100");
    blink($('#clignotant'), spd, num);
});

$('#clignotant').click(function() {
    if (init==0) {
        init++;
        //fn call INTENTIONALLY missing 4th param
        blink(this, 800, 3);
    }else{
        alert('Not document load, so process the click event');
    }
});

function blink(selector, blink_speed, iterations, counter){
    counter = counter | 0; //this line is reason why external call lacks 4th param
	$(selector).animate({opacity:0}, 50, "linear", function(){
		$(this).delay(blink_speed);
		$(this).animate({opacity:1}, 50, function(){
            counter++;
			if (iterations == -1) {
				blink(this, blink_speed, iterations, counter);
			}else if (counter >= iterations) {
				return false;
			}else{
				blink(this, blink_speed, iterations, counter);
			}
		});
		$(this).delay(blink_speed);
	});
}

//This line must come *AFTER* the $('#clignotant').click() function
window.load($('#clignotant').trigger('click'));

/********************************************************************
Trivia: clignotant is French for "signal light" or "vehicle blinker"
*********************************************************************/