Web development, must encounter like Baidu, Google this kind of search function, that intelligent form of automatic completion can do, the following to reveal:
1, including such as Google, Baidu and other similar simple search
2, the complex structure of support, such as the input product number, the product needs to be the number, product name, product price, product information, such as the note will fill out a place in the form
The code is as follows (page address: https://github.com/xiexingen/Bootstrap-SmartForm/blob/master/demo/form3-ele-autocomplete.html):
Automatic completion
Note: Need to introduce JS file: Jquery-ui.js, Jquery.fn.extend.js
Call the Smartsearch method by specifying the element after form generation completes
Parameter description:
URL: Requested URL
Beforesearch: Optional, the method that is called before sending the request, the method has a parameter data contains to send, if need to add or modify the parameters to send, modify the second parameter can
Formatitem: Optional, if the return is not a simple array string, then a custom action will be used to format the contents of the interface, shown in the example of the product number + product Name
Callback: Optional, if the return is not a simple array string, then the custom action will be used to assign the value
Note: If the interface returns a simple array of strings, both Formatitem and callback can be omitted
This is a screenshot of my local test project that runs:
The above is a small set to introduce the bootstrap intelligent form of the actual Combat series (10) automatically complete the support of the components of all the narrative, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!