ajax - Autocomplete jQuery on facebox -


i need use autocomplete (in particular try plugin http://scottreeddesign.com/project/jsuggest) in text input in facebox. didn't work beacause in document ready there function:

                $(document).ready( function(){                                        /** suggest new quid **/                         $('#idinput').jsuggest({                              default_text: 'inserisci il quid',                              terms_url:      'data.php'+'%input%',                              limit: 10                         });                             $('#idlink').live('click', function(e) {  jquery.facebox("<input type='text' id='idinput' />") });                 }); 

but dom #idinput don't exist, show in facebox when click link.

can me? suggestion?

p.s. plugin jsuggest isn't required. first i've found.

the solution bind jsuggest plugin right on click event:

 $('#idlink').live('click', function(e)   {     jquery.facebox("<input type='text' id='idinput' />").jsuggest(        {           default_text: 'inserisci il quid',           terms_url:      'data.php'+'%input%',           limit: 10        });   }); 

or maybe better:

 $('#idlink').live('click', function(e)   {     $("<input type='text' id='idinput' />").jsuggest(        {           default_text: 'inserisci il quid',           terms_url:      'data.php'+'%input%',           limit: 10        }).facebox();   }); 

edit: solutions above doesn't work try this:

 $('#idlink').live('click', function(e)   {     $input = $("<input type='text' id='idinput' />");     $input.jsuggest(        {           default_text: 'inserisci il quid',           terms_url:      'data.php'+'%input%',           limit: 10        });     $input.facebox();   }); 

anyway suggest use jquery-ui's autocomplete.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -