Bootstrap typeahead - How to set the default value manually

后端 未结 3 1532
情话喂你
情话喂你 2021-01-12 07:34

I tried this:

$(\"#typeahead_object\").val(\"test\");

It only changes the textbox value but doesn\'t trigger the \'updater\' function

3条回答
  •  孤独总比滥情好
    2021-01-12 07:40

    You could manually trigger a keyup event on the input element, after setting the value:

    $("#typeahead_object").val('test').focus().trigger('keyup')
    

提交回复
热议问题