How to use jquery autocomplete automatic completion plug-in_jquery
WBOY
Release: 2016-05-16 18:21:48
Original
1202 people have browsed it
First download the required files, jquery.autocomplete.js and jquery.autocomplete.css. Since the control can obtain data from arrays and URLs, I wrote two simple examples to test it. The front-end code is as follows:
protected void Page_Load( object sender, EventArgs e) { //The default key value passed in is q if (Request.QueryString["q"] != null) { string key = Request.Params["q"].ToString(); string result = ""; db db = new db(); string sql = "select UserName from Users where UserName like '" key "%'"; SqlDataReader dr = db.GetReader(sql); while (dr.Read()) { result = dr["UserName"].ToString() "n "; } if (result == "") result = "not exists"; Response.Write(result); } }
After writing it, I found that the desired function can be achieved, but there are always problems with the style. The result list displayed is quite ugly, it seems that CSS is not applied. After thinking about it for a long time, I still couldn't see what the problem was. This morning I suddenly realized that I had made a stupid mistake. I missed writing rel="stylesheet", MY GOD! I convinced myself. This completes a simple example. Keep learning.
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn