Problem with Autocomplete Jquery pluging and hidden field (#id)
Best to all,
I'm new around here, and also with jquery php programming. I appreciate the cooperation you can get.
Well, my problem is with the use of basic plugin for Jquery Autocoplete, I have not used any of the many that circulate on the Internet.
I managed to do well the search and query the database, it returns me the names of the students, the problem comes when I assign the id of the selected name to a hidden field of the form to send via the id _get to another page editor.
To achieve this autocomplete (or autosuggest), I created 3 files. 2 to make the query and process, and the next file that contains the form and the Javascript code that should work.
/ / -------- This field is not assigned it by javascript ----
</ form>
</ div> <! - # Search ->
<div id="resultados">
</ div> <! - # Results -> / / Here ends the part of the problem conicerne
Anyway, the point is that everything works fine except the assignment of the hidden field id on the form.
I've looked several times the official documentation and in many forums, and I can not figure out what goes wrong.
Sure I have not explained very well, I hope you understand me ....
This appears to be a typo error. JavaScript is case-sensitive. See the bold line in the code below. Also, I would recommend changing the id of your variable from "id" to something more descriptive. Using "id" as the value if your id attribute could cause problems in some browsers.
Code:
<script type="text/javascript">
$ (function () {
$ ('#buscar'). Autocomplete ({
source: 'ajax.php', / / php file that processes the search
minLength: 2,
select: function (event, ui) { // Here's my biggest problem -
$('#id').val (ui.item.id)
}
});
});
</script>
Visit Slightly Remarkable to see my portfolio, resumé, and consulting rates.
If you are using this Autocomplete plugin for jQuery, then you need to revise your code according to the documentation. However, based on your code, it looks like you're using some other Autocomplete plugin. Do you have a link to the documentation to this plugin?
Visit Slightly Remarkable to see my portfolio, resumé, and consulting rates.
Bookmarks