Last active
May 20, 2019 15:10
-
-
Save marcosfreitas/41a5d4e34f56a3ca6067 to your computer and use it in GitHub Desktop.
Autocomplete Search With Semantic UI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Autocomplete Search With Semantic UI</title> | |
<link rel="stylesheet" href="semantic/dist/semantic.css"> | |
</head> | |
<body> | |
<center style="padding: 30px 0;width: 227px;margin: 0 auto;"> | |
<h1>Search for colors</h1> | |
<div class="ui search focus"> | |
<div class="ui icon input"> | |
<input class="search" type="text" placeholder="Colors..." autocomplete="off"> | |
<i class="search icon"></i> | |
</div> | |
<div class="results"></div> | |
</div> | |
</center> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> | |
<script src="semantic/dist/semantic.js"></script> | |
<script> | |
// Define API endpoints once globally | |
$.fn.api.settings.api = { | |
'search' : '/search/colors/?query={value}' | |
}; | |
$('.search input') | |
.api({ | |
debug: true, | |
action: 'search', | |
url: 'http://localhost/semantic-ui/labs/colors/colors.php?query={value}', | |
searchFullText: false, | |
stateContext: '.ui.input' | |
}) | |
; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment