Skip to content

Instantly share code, notes, and snippets.

@ssbb
Created March 15, 2015 15:01
Show Gist options
  • Save ssbb/9ca3a9db2eb153609951 to your computer and use it in GitHub Desktop.
Save ssbb/9ca3a9db2eb153609951 to your computer and use it in GitHub Desktop.
{% extends "layout.html" %}
{% block body %}
<input type="text" id="interaction">
<input type="submit" value="submit" id="submit">
<script type="text/javascript" src="/static/js/jquery-1.11.1.min.js"></script>
<script type="text/javascript">
$(document).on('ready', function() {
$(document).on('keyup', '#interaction', function(e) {
if (e.keyCode == 13) {
$("#submit").click();
}
});
$(document).on('click', '#submit', function() {
alert('YAHOO!');
});
{% if query %}
$("#interaction").val("{{query}}");
$("#submit").click();
{% endif %}
});
</script>
{% endblock %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment