input flash

/**
 * Fait clignoter un champ input pour attirer l'attention sur celui - ci
 * 
 * It takes a CSS selector, a time in milliseconds, a border color and a background color, and then
 * flashes the border and background of the element selected by the CSS selector
 * 
 * @param string selecteur_css 
 * @param int time temps en milliseconde du clignotement 
 * @param string borderColor couleur que va prendre la bordure lors du clignotement 
 * @param string backgroundColor couleur que va prendre la background lors du clignotement
 */

function input_flash(selecteur_css , time = 150 , borderColor = "red" , backgroundColor = "yellow" ){

    let input = document.querySelector(selecteur_css);

    let borderColorOrigine      = input.style.borderColor;
    let backgroundColorOrigine  = input.style.backgroundColor;

    input.style.borderColor     = borderColor;
    input.style.backgroundColor = backgroundColor;

  setTimeout(() => {     
        input.style.borderColor     = borderColorOrigine;
        input.style.backgroundColor = backgroundColorOrigine;
    }, time);
}
Joyous Jaguar