// Assume the input element has an id of search
// <input type="text" id="search" />
const search = document.getElementById("search");
search.addEventListener("keyup", function (e) {
const inputText = e.target.value; // Get the text typed by user
console.log(inputText); // log the input text out
});
<input type="text" class="form-control" placeholder="Search" id="search_id"/>
<script type="text/javascript">
const log = document.getElementById('search_id');
document.addEventListener('keyup', logKey);
function logKey(e) {
const value=log.value;
if (e.key === 'Enter' || e.keyCode === 13) {
transmit({search: value});
}
};
</script>
document.addEventListener("keyup", function(e) {
e = e || window.event;
// Add scripts here
e.keyCode; // -> returns the keycode of the key that triggered the event
e.key.toString(); // -> returns the ASCII character of the key that triggered the event
});