Предупреждение |
---|
jQuery-плагин больше не развивается. Рекомендуем вместо него использовать JavaScript-виджет. |
Блок кода |
---|
|
<input id="email" name="email" type="text" />
<link href="http://ВАШ_СЕРВЕР:ПОРТ/suggestions/libs/jquery.suggestions/stable/css/suggestions.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript" src="http://ВАШ_СЕРВЕР:ПОРТ/suggestions/libs/jquery.suggestions/stable/js/jquery.suggestions.js"></script>
<script type="text/javascript">
$("#email").suggestions({
serviceUrl: "http://ВАШ_СЕРВЕР:ПОРТ/suggestions/api/4_1/rs",
type: "EMAIL",
/* Вызывается, когда пользователь выбирает одну из подсказок */
onSelect: function(suggestion) {
console.log(suggestion);
}
});
</script> |
Раскрыть |
---|
|
Блок кода |
---|
<input id="email" name="email" type="text" />
<link href="http://ВАШ_СЕРВЕР:ПОРТ/suggestions/libs/jquery.suggestions/master/css/suggestions.css" type="text/css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="http://ВАШ_СЕРВЕР:ПОРТ/suggestions/libs/jquery.suggestions/master/js/jquery.suggestions.js"></script>
<script>
$("#email").suggestions({
serviceUrl: "http://ВАШ_СЕРВЕР:ПОРТ/suggestions/api/4_1/rs",
type: "EMAIL",
/* Вызывается, когда пользователь выбирает одну из подсказок */
onSelect: function(suggestion) {
console.log(suggestion);
}
});
</script> |
|
Аргумент suggestion функции onSelect выглядит так:
...
Объект suggestion
В обработчик onSelect
передается объект с полями email.
Настройки