jquery redirect on keydown is not working

MikeStardust

So i am trying to redirect users from the homepage to the forums with a keyboard event, This is the current code that does not seem to be working:

$(document).ready(function(){
        $("body").keydown(function(e){
            var key = e.keyCode;

            if (key == 13){
                window.location.href = "forums";
            }
        }); 
    });

The homepage is on the site root, as well as the forums folder.
The console is clean, no errors, no alerts...
All suggestions and comments are more than welcome and appreciated! Thanks!

PlamZ

Is forum an HTML File?

If yes, it would be important to add the extension or the complete path.

/views/Forums/forums.html

Also, make sure that, if you use the different numeral values for the key, to be sure that the number is the one you are really looking for. You can find a list of the values here.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Jquery Change color by input[type=text] keydown not working

분류에서Dev

Jquery Redirect

분류에서Dev

URL redirect not working with .htaccess not working

분류에서Dev

Django redirect() not working

분류에서Dev

Codeigniter: Redirect not working

분류에서Dev

TextBox KeyDown Trigger Event not working for Backspace and Delete key

분류에서Dev

Primefaces comondButton redirect stopped working

분류에서Dev

To get the url name and redirect in jQuery

분류에서Dev

Redirect 301 on changed root name not working

분류에서Dev

wp_logout_url($redirect); is not working

분류에서Dev

Redirect not working as I'm expecting in Rails

분류에서Dev

jquery .animate is not working

분류에서Dev

Login with jQuery AJAX is not working

분류에서Dev

JQuery Parallax not working

분류에서Dev

JQuery not working on Joomla 3

분류에서Dev

jQuery .post() function not working

분류에서Dev

jquery post not working and no error

분류에서Dev

Jquery content slider not working

분류에서Dev

If condition not working in Javascript/Jquery

분류에서Dev

jQuery settimeout() not working correctly

분류에서Dev

Wordpress JQuery not working

분류에서Dev

jQuery validation not working with that form

분류에서Dev

jquery addClass is not working

분류에서Dev

else not working (Jquery)

분류에서Dev

jQuery click(function) not working

분류에서Dev

Responsive jquery is not working correctly

분류에서Dev

addClass('open') is not working in jquery

분류에서Dev

Express: jQuery Validation not working

분류에서Dev

Jquery .next() not working as expected