Created
September 25, 2015 02:11
-
-
Save ptahdunbar/1dfd056214160ecbf767 to your computer and use it in GitHub Desktop.
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
<html> | |
<head> | |
<script src="https://code.jquery.com/jquery-2.1.4.js" charset="utf-8"></script> | |
<script> | |
function showHint(str) { | |
console.log(str) | |
jQuery.get("gethint.php?q=" + str, function(data){ | |
document.querySelector('#txtHint').innerHTML = data; | |
}); | |
return false; | |
} | |
</script> | |
</head> | |
<body> | |
<p><b>Start typing a name in the input field below:</b></p> | |
<form> | |
First name: <input type="text"> | |
</form> | |
<p>Suggestions: <span id="txtHint"></span></p> | |
</body> | |
<script> | |
document.getElementsByTagName('form')[0].onsubmit = function () { | |
showHint(document.getElementsByTagName('input')[0].value); | |
return false; | |
}; | |
//showHint(document.getElementsByTagName('input')[0].value)); | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment