I have a search input field and I'm using javascript to move through the search suggestions, the problem i'm facing is that every time someone presses up or down the text cursor moves to the first/last character in the input field, I tried using
event.preventDefault with no succes.
Here is a test page for it:
<input type="text">
<script type="text/javascript">
document.onkeyup = KeyCheck;
function KeyCheck(evt)
{
var evt=(evt)?evt:event;
var KeyID = evt.keyCode;
switch(KeyID)
{
case 40:
alert("Pressed DOWN");
break;
case 38:
alert("Pressed UP");
break;
}
}
</script>
Thank you in advance for any help on my issue.