jquery left arrow key press

<html>
<head>
<title>jQuery Arrow Keys | Bind Arrow Keys using jQuery</title>
<script type="text/javascript" src="js/jquery-1.8.2.min.js"></script>
</head>

<body>

Hit the arrows keys on your keyboard to see the alert!

<script type="text/javascript">

$(document).keydown(function(e){

	//e.which is set by jQuery for those browsers that do not normally support e.keyCode.
	var keyCode = e.keyCode || e.which;

    if (keyCode == 38) 
	{ 
       alert( "Up arrow key hit." );
       return false;
    }

    if (keyCode == 40) 
	{ 
       alert( "Down arrow key hit." );
       return false;
    }

    if (keyCode == 37) 
	{ 
       alert( "Left arrow key hit." );
       return false;
    }

    if (keyCode == 39) 
	{ 
       alert( "Right arrow key hit." );
       return false;
    }

});

</script> 
</body>
</html>

3.8
5
Raina Ali 100 points

                                    $(&quot;body&quot;).keydown(function(e) {
  if(e.keyCode == 37) { // left
    $(&quot;#showroom&quot;).animate({
      left: &quot;-=980&quot;
    });
  }
  else if(e.keyCode == 39) { // right
    $(&quot;#showroom&quot;).animate({
      left: &quot;+=980&quot;
    });
  }
});

3.8 (5 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
jquery left arrow key press event up down arrow jquery keyboard on arrow keys press jquery jQuery arrow keys navigation arrow keyup button jquery arrow keypress jquery arrow key press jquery ctrl +arrow keys function jquery arrow key function in jquery arrow key event in jQuery jquery on keyboard arrow jquery detect arrow keys value for arrow right keypress jquery left right arrow jquery program arrow keys jquery on arrow keypress jquery on arrow key press jquery left arrow key value in jquery right arrow key value jquery jquery arrow functions jquery if arrow down key press jquery event arrow function down arrow hotkey in jquery jquery keyboard arrow keys jquery capture arrow keys jquery arrow keys up and down arrows key code jquery arrow keys keypress down arrow key code jquery keyboard arrow right jquery up arrow key jquery jquery keybord arrow arrow key in keyboard jquery on click jquery arrow keyboard arrow keys with keypress jquery jquery get arrow key press jquery global arrow keys press jquery arro click shift+left arrow key event jquery up and down arrows jquery js string for arrow keys jQuery Arrow Keys Binding Examples js bind keystroke on arrow up and down jquery send value to key in function jquery jquery listen for keypress keydown Keypress with JQuery on key pressed jquery jquery keycode if or jquery event keypress activate a event when tab key is pressed jquery jquery key press js look for key binds up down left right keys js right arrow event jquery arrow keys jquery click jquery keypress and arrow press left and right arrow buttons js left and right arrow js jquery keydown arrow keys javascript left right arrow navigation define inputs and outputs of function jquery with right/left arrow what does &quot;=&gt;&quot; (right + left arrow in jquery mean? keybind to up down right lefft arrows javascript jquery arrow pressed how to detect up arrow press in jquery keys select up down keyboard up/down arrow js javascript on click arrow how to use arrow keys in jquery assign value to key javascript key arrow jquery arrow keys event how to map in jquery with arrow key how to use map in jquery use arrow key jquery left right arrow keys jquery unbinding specific key board keys jquery on arrow key jquery on arrow key press javascript left righ arrow jquery shortcut arrow keys jquery left arrow key press override
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source