Vous pourriez créer une fonction comme celle-ci. Comme vous n'avez pas spécifié comment il devrait clignoter ou combien de fois, je l'ai fait changer la couleur d'arrière-plan en rouge et ensuite, après 500 ms, la remettre à la précédente. Cela donnera l'impression que ça clignote.
function blink($target) {
// Set the color the field should blink in
var backgroundColor = 'red';
var existingBgColor;
// Load the current background color
existingBgColor = $target.css('background-color');
// Set the new background color
$target.css('background-color', backgroundColor);
// Set it back to old color after 500 ms
setTimeout(function() { $target.css('background-color', existingBgColor); }, 500);
}
Lorsque vous voulez appeler la fonction de clignotement faire ceci:
function processForm() {
blink($("#name"));
}
Cela fonctionnera si vous avez un champ d'entrée avec l'ID 'name'
Blink un élément de sélection
HTML:
<select id="selectList">
<option>Hello</option>
<option>World</option>
</select>
JavaScript (par exemple sur prêt):
$(function() {
blink($("#selectList"))
});
vous pouvez également ajouter une bordure et scrollTo si votre page est longue –