Bryce910 Posted April 26, 2012 Share Posted April 26, 2012 I am new to java script and I am curious is it possible to have a java script function click when I hit a certain button on my keyboard. Like if I hit (space) it would run a java script function I have built? Quote Link to comment https://forums.phpfreaks.com/topic/261645-javascript-run-function/ Share on other sites More sharing options...
gristoi Posted April 26, 2012 Share Posted April 26, 2012 Short answer : yes. if you were using jquery then you could go something along the lines of $(document).keyDown(function(){ // check if the key pressed was the spacebar //if so run the function }); Quote Link to comment https://forums.phpfreaks.com/topic/261645-javascript-run-function/#findComment-1340707 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.