Autocomplétion
Résolu
Bonjour, j'essaie tant bien que mal de faire une autocomplétion pour mon site. Alors j'ai juste fait un petit test avec une zone de texte, mais je ne sais pas trop pourquoi, ça ne marche pas... Alors voilà mon code :
<!DOCTYPE>
<html>
<form>
<input type="text" id="recherche">
</form>
<script language="javascript">
var liste = [
"Bobine",
"Munition",
"Canon",
"Poudre",
"Cuivre"
];
$('#recherche').autocomplete({
source : liste,
minLength : 3
}
});
</script>
</html>
Pourriez-vous m'aider à trouver le problème ?
Merci d'avance !
<!DOCTYPE>
<html>
<form>
<input type="text" id="recherche">
</form>
<script language="javascript">
var liste = [
"Bobine",
"Munition",
"Canon",
"Poudre",
"Cuivre"
];
$('#recherche').autocomplete({
source : liste,
minLength : 3
}
});
</script>
</html>
Pourriez-vous m'aider à trouver le problème ?
Merci d'avance !
3 réponses
-
Je suppose que jQuery & jQueryUI sont bien importer ?
-
Essayer
<!DOCTYPE html> <html> <head> <title>Test d'autocomplete</title> <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css"> <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script> </head> <form> <input type="text" id="recherche"> </form> <script language="javascript"> var liste = [ "Bobine", "Munition", "Canon", "Poudre", "Cuivre" ]; $('#recherche').autocomplete({ source : liste, minLength : 3 }); </script> </html> -
Oui ça marche très bien, merci beaucoup !