Here's the code:
When I try to load the function myList() on page load Console shows "mylist entered" in Chrome, Opera but doesn't seem to work in Firefox.
However the function myList() works(even in Firefox) from inside the keyup function which I have commented in the below code:
<!DOCTYPE html>
<html>
<head>
<title>List</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
console.log('ready');
$(function () {
// body...
$('#omnibox').focus();
if (window.localStorage) {
//Enter key binding
var todo = document.querySelector('#omnibox');
//debugger;
$('#omnibox').keyup(function(e){
if(e.keyCode == 13)
{
console.log("Enter pressed!");
var todoVal = document.querySelector('#omnibox').value;
//myList();
}
});
myList();
function myList()
{
console.log("mylist entered");
}
}
});
</script>
</head>
<body>
<h2>List</h2>
<input type="text" id="omnibox">
<div id='searchWrapper'>
</div>
</body>
</html>