开发者

How to trigger the select event handler in jqueryui autocomplete combobox?

开发者 https://www.devze.com 2023-04-10 04:53 出处:网络
I have a jqueryui autocomplete combo-box widget in which once the user selects something in the combobox, the select event handler within the combo-box makes an ajax call to render content in another

I have a jqueryui autocomplete combo-box widget in which once the user selects something in the combobox, the select event handler within the combo-box makes an ajax call to render content in another div element. EG:

[combo-box] > [div]

The div contains content in which the user can then click submit to go to a different page.

I am running into a problem in which if the user clicks on the back button AFTER having made a selection within the combo-box and then clicking within the div to go to the next page, the combo-box will display the last selected value, but the div will display the value as it was originally rendered on the page, prior to the ajax request (which populated the div with dynamic content). As a result, the displayed value within the combo-box is now inconsistent with the displayed content in the div.开发者_JAVA技巧

The solution to this problem requires that I trigger the select of a certain value within the combo-box when the page is first loaded, so that the select event handler within the jqueryui autocomplete combobox code is run, which will reload the div.

What is the best way to do so?


You could store the selected value into a hidden input and on page load paint the content div with the value in the hidden input (if any)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号