I'm trying to show a loading gif after to press some key on a form.
I have this code. When I press a key the image is shown, but then if you did not press anything, still displays..... I want something that when I press a key the imagen is display and when I stop to press keys the imagen stop to showing
<html>
<head>
<script type="text/javascript" src="jquery-1.8.2.min.js"></script>
</head>
<body>
Enter your name: <input type="text" id="fname" onkeyup="displayResult()">
<img src="ajaxload.gif" id="load" style="display: none">
<script>
function displayResult()
{
$("#load").show();
}
</script>
</body>
Thanks in advance