jQuery-UI Autocomplete submitting form onclick of item from dropdown list

后端 未结 3 853
死守一世寂寞
死守一世寂寞 2021-01-14 11:46

I\'m using the jQueryUI autocomplete() function and I can\'t figure out how to have my form submit when an item is selected.

I think the issue is with t

相关标签:
3条回答
  • 2021-01-14 12:05

    Yeah Alice is also right. You just need to add this line in your onclick function:

     $('#search_form').submit();
    

    where search_form is the id of your form.

    0 讨论(0)
  • 2021-01-14 12:10

    Andrew was correct, see the fiddle he mentioned. If you switch the part with "ui.item" to "ui.item.value" the select: function() now works perfectly.

    0 讨论(0)
  • 2021-01-14 12:13

    Yes it works

    Except if you expect to get the value in your server-side script in the page called by action...

    For now, no way to find why auto-submit of the form after selection by mouse or by keyboard, and the $(event.target).val(ui.item.value) line, don't deliver the value in $_POST array

    0 讨论(0)
提交回复
热议问题