I spent a little time today doing the styling of my Facebook project. I want to try and get at least one major part of it done each day. Here is what I have done so far with the search-bar. I want to make the search-bar connect to the database and pull out the names with an auto-complete of the name. Shouldn't be too hard, right? I think I wall have to make this a form, then send it to the process page and have some code to make it look like magic haha. I still have some work to do on the styling of the search-bar though. I need to get the placeholder font and placement exact.
Here is the code I used to get the search-bar to auto-complete. The '#tags' are for the input id in the HTML, that corresponds to the search-bar. When you click in the search-bar, the function runs (below) and if what you have typed in the search bar matches any of those four, you can select the one you want. I only put four for testing purposes.
<script>
$(document).ready(function() {
$(function() {
var availableTags = [
"Kyle Anderson",
"Reggie Smith",
"Amy John",
"Bob Bobby",
];
$( "#tags" ).autocomplete({
source: availableTags
});
});
});
</script>
^ will probably be messed up when this is published.. Sigh...
- Kyle
No comments:
Post a Comment