<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>bind-arrow-keys &#8211; Extreme Web Designs</title>
	<atom:link href="https://theextremewebdesigns.com/blog/tag/bind-arrow-keys/feed/" rel="self" type="application/rss+xml" />
	<link>https://theextremewebdesigns.com/blog</link>
	<description>Web Design and Web Development</description>
	<lastBuildDate>Fri, 22 Jun 2012 02:52:27 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.5</generator>
<site xmlns="com-wordpress:feed-additions:1">156673191</site>	<item>
		<title>jQuery Arrow Keys Binding Examples</title>
		<link>https://theextremewebdesigns.com/blog/jquery-arrow-keys-bind-arrow-keys-using-jquery/</link>
					<comments>https://theextremewebdesigns.com/blog/jquery-arrow-keys-bind-arrow-keys-using-jquery/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 22 Jun 2012 02:52:27 +0000</pubDate>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[bind-arrow-keys]]></category>
		<category><![CDATA[jquery-arrow-keys]]></category>
		<category><![CDATA[jquery-demos]]></category>
		<category><![CDATA[jquery-tips]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=959</guid>

					<description><![CDATA[jQuery Arrow Keys: Have you ever wondered how to bind arrow keys using jQuery? Let&#8217;s say that you want to enhance your user experience to a website by using jQuery or you want to trigger an action when certain key, such as the Up arrow key or Down arrow key, etc. is pressed, do you know [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>jQuery Arrow Keys:</strong> Have you ever wondered how to <strong>bind arrow keys using jQuery</strong>? Let&#8217;s say that you want to enhance your user experience to a website by using jQuery or you want to trigger an action when certain key, such as the Up arrow key or Down arrow key, etc. is pressed, do you know what code can be used? In this article, I am going to share with you an easy way to <strong>bind arrow keys using jQuery</strong> with easy to follow examples.</p>
<p><span id="more-959"></span></p>
<h2>How to use jQuery to Bind Arrow Keys</h2>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=959" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<p>At one time or the other, you might end up developing an app that requires you to perform a certain action when the arrow keys are hit/pressed. In such a case, you can execute specific code if you can find out which arrow key was hit. There are different key codes for each of the arrow key and we can use this to our advantage. And in order to use this, we will need to <em><strong>bind arrow keys</strong></em> based on their unique codes. Following are the examples to show you how to do this.</p>
<h3>Example: Bind Arrow Keys using jQuery</h3>
<p>This example has code that monitors for arrow key hit event and then triggers an alert indicating the arrow key that was hit. Simply execute the following code and hit the arrows keys on your keyboard to see the alert message.</p>
<pre class="lang:xhtml decode:true">&lt;html&gt;
&lt;head&gt;
&lt;title&gt;jQuery Arrow Keys | Bind Arrow Keys using jQuery&lt;/title&gt;
&lt;script type="text/javascript" src="js/jquery-1.8.2.min.js"&gt;&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;

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

&lt;script type="text/javascript"&gt;

$(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;
    }

});

&lt;/script&gt; 
&lt;/body&gt;
&lt;/html&gt;</pre>
<div class="make_demo">

	<form action="https://theextremewebdesigns.com/blog/wp-content/themes/ewd_blog_2017/try_demo.php?post_id=959" method="post" name="form1" target="_blank" id="form1">


	<input type="hidden" name="shortcode_content" id="shortcode_content" value="" />

        <div class="try_demo_btn_container">


            <button type="submit" name="sbt_make_demo" id="sbt_make_demo" class="btn-primary btn-try-demo">
                Try Demo
            </button>


        </div><!-- .try_demo_btn_container -->

    </form>
    </div>
    
<h5>That&#8217;s it!</h5>
<p>Do you know of any other ways to <strong>bind arrow keys using jQuery</strong>? Feel free to suggest by commenting below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/jquery-arrow-keys-bind-arrow-keys-using-jquery/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">959</post-id>	</item>
	</channel>
</rss>
