Home  >  Q&A  >  body text

Hello teacher, jump to the question

In order to test the jump, I added a button to the page with the ID register11, but the jump did not respond. Please tell me what's wrong.

$("#register11").on('click', function () {

window.location.href = "http://www.jb51.net";

}),


mama1951 days ago1327

reply all(5)I'll reply

  • kanglecheng

    kanglecheng2019-07-12 14:31:48

    <p id="register11">点击</p>
    <script src="http://cdn.bootcss.com/jquery/1.10.2/jquery.min.js"></script>
    $("#register11").click(function(){
       window.location.href = "http://www.jb51.net";
    });

    This way of writing requires the introduction of jquery.js

    reply
    0
  • ma

    ma2019-07-11 11:25:53

    The id was created by myself, the function is valid, and even if I add an alert information window, it will appear, but nothing will happen when jumping. Can you help me jump for this test? I'll test it.

    reply
    0
  • ma

    Can the teacher write a small code to test the jump? I will test it.

    ma · 2019-07-11 11:29:34
    ma

    Does it have anything to do with whether pop-up windows and redirects are blocked in Google browser?

    ma · 2019-07-11 12:27:07
  • 自然

    自然2019-07-11 10:40:26

    The ID is register11. Is it on the page or modified by other js

    reply
    0
  • Cancelreply