jquery-autocomplete

Focus on a jQuery autocomplete result (not necessarily the first)

不打扰是莪最后的温柔 提交于 2019-12-01 07:33:05
I am struggling to extend jQuery autocomplete so that a particular item has focus by default. The out-of-the-box functionality works pretty well, but it's not perfect. Using the autoFocus option I can automatically focus on the first item. $( "#input" ).autocomplete({ source: "autocomplete.php", minLength: 1, autoFocus: true }); However, I would like to have more control over which item is focused. If the user types in "eng" and the relevant items that my source returns are: American English British English English Scots English I would like the third item, English , to be in focus by default

Jquery UI autocomplete ajax is not populating dropdown box

*爱你&永不变心* 提交于 2019-12-01 06:51:47
I need help with this, I can't see where is the problem. When I set source for autocomplete in html file, it works fine, when I same source or database values print out in ajax.php and return it via ajax it doesn't work. What could be the problem? Help please. Html : <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Auto complete</title> <script type="text/javascript" src="jquery-1.7.1.min.js"></script> <script type="text/javascript" src="jquery-ui-1.8.18.custom.min.js"></script> <link rel="stylesheet" media="all" type="text/css" href=

Fixed positioned search box with Autocomplete suggestions

拈花ヽ惹草 提交于 2019-12-01 06:38:13
In my webapp I have a search box in a fixed toolbar on the top of webpage. I implemented the fixed position of toolbar like this.... #toolbar { position: fixed !important; position: absolute; height: 25px; width: 100%; top: 0px; left: 0px; margin: 0; z-index: 100; font-size: 12px; } Now, I am implementing a keyword autocomplete function on it using a jQuery plugin . My problem is how to keep the autocomplete suggestions fixed/attached to the search box when the window is scrolled/resized. The css for autocomplete suggestions box is.... element.style { display:none; left:166px; position

Is it possible to change the Url which JQuery's JQueryUI Autocomplete generates?

做~自己de王妃 提交于 2019-12-01 06:16:37
I'm using JQuery JQueryUI's AutoComplete code. It goes to my url i provide (to find the answers), but appends ?term=<search query> after the url. I'm trying to get the following url intead ... /myurl/<term / search query> eg. /myurl/abcd /myurl/hello+world etc... is it possible to do this? Otherwise, it is possible to rename the query parameter term to something else, .. like query to q , etc? You can use $.getJSON() yourself in the source option , for example: $(".autocomplete").autocomplete({ source: function(req, resp) { $.getJSON("/myurl/" + encodeURIComponent(req.term), resp); } });

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

≯℡__Kan透↙ 提交于 2019-12-01 06:02:12
问题 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 the select: event but I'm new with jQueryUI and can't figure out how to make this work. Here's my code which works fine otherwise: <script type="text/javascript"> $(document).ready(function() { $(function() { $( "#search_box" ).autocomplete({ source: function(request, response) { $.ajax({ url: "<?php echo site_url('autocomplete/suggestions'); ?>"

jQuery UI - Autocomplete - Custom style?

懵懂的女人 提交于 2019-12-01 05:14:31
I'm using the following code and it's working, getting values back etc, but the <b> and <br> tags show up as text rather than get rendered. I'd like the item.id and item.label to be on different lines, if possible the item.id bold: $( "#predictSearch" ).autocomplete({ source: function( request, response ) { $.ajax({ url: "index.pl", dataType: "json", data: { term: request.term }, success: function( data ) { response( $.map( data.items, function( item ) { return { label: '<B>' + item.id + '</B><br>' + item.label, value: item.id } })); } }); }, minLength: 2 }); It seems like you have some extra

Jquery UI autocomplete ajax is not populating dropdown box

不打扰是莪最后的温柔 提交于 2019-12-01 05:09:53
问题 I need help with this, I can't see where is the problem. When I set source for autocomplete in html file, it works fine, when I same source or database values print out in ajax.php and return it via ajax it doesn't work. What could be the problem? Help please. Html : <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Auto complete</title> <script type="text/javascript" src="jquery-1.7.1.min.js"></script> <script type="text/javascript" src=

iframe disappears for no apparent reason after dynamically creating it

北慕城南 提交于 2019-12-01 04:47:13
This is quite difficult to explain, but I've never experienced something like this before. I've also created a GIF to display what the issue looks like. The first time I open my chrome extension and make a search the iframe works perfectly fine. The second time I open my chrome extension and make a search the iframe disappears (see GIF). As you can see the iframe suddenly disappears for no apparent reason, and if I right click and go into inspect element and edit even the most unrelated item then all of a sudden the iframe reappears. Is there a simple solution I can try? As I said when I

Is it possible to change the Url which JQuery's JQueryUI Autocomplete generates?

不羁的心 提交于 2019-12-01 04:24:24
问题 I'm using JQuery JQueryUI's AutoComplete code. It goes to my url i provide (to find the answers), but appends ?term=<search query> after the url. I'm trying to get the following url intead ... /myurl/<term / search query> eg. /myurl/abcd /myurl/hello+world etc... is it possible to do this? Otherwise, it is possible to rename the query parameter term to something else, .. like query to q , etc? 回答1: You can use $.getJSON() yourself in the source option, for example: $(".autocomplete")

iframe disappears for no apparent reason after dynamically creating it

人盡茶涼 提交于 2019-12-01 02:00:29
问题 This is quite difficult to explain, but I've never experienced something like this before. I've also created a GIF to display what the issue looks like. The first time I open my chrome extension and make a search the iframe works perfectly fine. The second time I open my chrome extension and make a search the iframe disappears (see GIF). As you can see the iframe suddenly disappears for no apparent reason, and if I right click and go into inspect element and edit even the most unrelated item