Autocompleter.Request.HTML
хочется ловить событие пользователь выбрал элемент
пробывал ловить onSelection но в парамтрах приходит <ul>
а мне нужен выбраный <li>
вот что туда передаётся в параметры
this.fireEvent('onSelection', [this.element, this.selected, value,
input]);
не пойму как мне получать выбраный пользователем li
Заранне спасибо!
сервер отдаёт список
<ul>
<li></li>
</ul>
'injectChoice': function(choice) {
// choice is one <li> element
var text = choice.getFirst();
// the first element in this <li> is the <span> with the text
var value = text.innerHTML;
// inputValue saves value of the element for later selection
choice.inputValue = value;
// overrides the html with the marked query value (wrapped in a
<span>)
text.set('html', this.markQueryValue(value));
// add the mouse events to the <li> element
this.addChoiceEvents(choice);
},
On 10 фев, 10:14, faust45 <faust...@gmail.com> wrote:
> ÎÅ ÐÏÎÑÌ ×ÏÐÒÏÓ.
>
> ÓÅÒ×ÅÒ ÏÔÄÁ£Ô ÓÐÉÓÏË
> <ul>
> <li></li>
> </ul>
>
> 'injectChoice': function(choice) {
> // choice is one <li> element
> var text = choice.getFirst();
> // the first element in this <li> is the <span> with the text
> var value = text.innerHTML;
> // inputValue saves value of the element for later selection
> choice.inputValue = value;
> // overrides the html with the marked query value (wrapped in a
> <span>)
> text.set('html', this.markQueryValue(value));
> // add the mouse events to the <li> element
> this.addChoiceEvents(choice);
> },
>
> On 9 ÆÅ×, 23:49, ApelSYN <oleg.cher...@gmail.com> wrote:
>
>
>
> > html Ë ËÏÔÏÒÏÍÕ ÃÅÐÌÑÅÛØ ÓÏÂÙÔÉÅ ÎÁÐÉÛÉ
>
> > On 9 ÆÅ×, 18:37, faust45 <faust...@gmail.com> wrote:
>
> > > ÷ÓÅÍ ÐÒÉ×ÅÔ.
>
> > > Autocompleter.Request.HTML
> > > ÈÏÞÅÔÓÑ ÌÏ×ÉÔØ ÓÏÂÙÔÉÅ ÐÏÌØÚÏ×ÁÔÅÌØ ×ÙÂÒÁÌ ÜÌÅÍÅÎÔ
> > > ÐÒÏÂÙ×ÁÌ ÌÏ×ÉÔØ onSelection ÎÏ × ÐÁÒÁÍÔÒÁÈ ÐÒÉÈÏÄÉÔ <ul>
> > > Á ÍÎÅ ÎÕÖÅÎ ×ÙÂÒÁÎÙÊ <li>
>
> > > ×ÏÔ ÞÔÏ ÔÕÄÁ ÐÅÒÅÄÁ£ÔÓÑ × ÐÁÒÁÍÅÔÒÙ
> > > this.fireEvent('onSelection', [this.element, this.selected, value,
> > > input]);
>
> > > ÎÅ ÐÏÊÍÕ ËÁË ÍÎÅ ÐÏÌÕÞÁÔØ ×ÙÂÒÁÎÙÊ ÐÏÌØÚÏ×ÁÔÅÌÅÍ li
>
> > > úÁÒÁÎÎÅ ÓÐÁÓÉÂÏ!
я несовсем понял вопрос
<script>
$each($$('#myList li'), function(li,index) {
li.addEvent('click', function(event) {
// тут пишем обработчик, который срабатывает при нажатии на один из
li, например:
alert(li.get('html'))
}.bind(this));
})
</script>