admin管理员组

文章数量:1313313

I know this question has been asked probably too many times before but none of those solutions has been able to help me out.I keep getting the above error even if I have everything in place AFAIK.

I have included the button in the html code but when i try to find them through jquery error: "Cannot read property 'ready' of null" occurs moreover it does not even recognize the document.ready function. Here is my full code:

<!DOCTYPE html>

<html xmlns="">
<head>
    <title></title>
    <script src="Scripts/jquery.js"></script>
    <script src="Scripts/jsencrypt.js"></script>
    <script src="Scripts/jsencrypt.min.js"></script>
    <script src="Scripts/jsencrypt.min.js"></script>
    <script src="Scripts/jsencrypt.js"></script>
    <script type="text/javascript" src="System.js"></script>
    <script type="text/javascript" src="System.IO.js"></script>
    <script type="text/javascript" src="System.BigInt.js"></script>
    <script type="text/javascript" src="System.BitConverter.js"></script>
    <script type="text/javascript" src="System.Convert.js"></script>
    <script type="text/javascript" src="System.Security.Cryptography.HMACSHA1.js"></script>
    <script type="text/javascript" src="System.Security.Cryptography.js"></script>
    <script type="text/javascript" src="System.Security.Cryptography.RSA.js"></script>
    <script type="text/javascript" src="System.Security.Cryptography.SHA1.js"></script>
    <script type="text/javascript" src="System.Text.js"></script>

    <script type="text/javascript">
        $(document).ready(function () {
            alert("button");

        });
      //  debugger;
     //   var element = document.getElementById("btntest");

        //$("#btntest").click(function () {
        //    alert("button");
        //});

    </script>

</head>
<body>
    <input type="button" id="btntest" value="Test" />


    <span>Name:</span>
    <input type="text" id="txtName" />
    <br />
    <br />

    <input type="button" id="btnSend" value="Send" />




</body>
</html>

Any suggestions to resolve this would be really appreciated.

I know this question has been asked probably too many times before but none of those solutions has been able to help me out.I keep getting the above error even if I have everything in place AFAIK.

I have included the button in the html code but when i try to find them through jquery error: "Cannot read property 'ready' of null" occurs moreover it does not even recognize the document.ready function. Here is my full code:

<!DOCTYPE html>

<html xmlns="http://www.w3/1999/xhtml">
<head>
    <title></title>
    <script src="Scripts/jquery.js"></script>
    <script src="Scripts/jsencrypt.js"></script>
    <script src="Scripts/jsencrypt.min.js"></script>
    <script src="Scripts/jsencrypt.min.js"></script>
    <script src="Scripts/jsencrypt.js"></script>
    <script type="text/javascript" src="System.js"></script>
    <script type="text/javascript" src="System.IO.js"></script>
    <script type="text/javascript" src="System.BigInt.js"></script>
    <script type="text/javascript" src="System.BitConverter.js"></script>
    <script type="text/javascript" src="System.Convert.js"></script>
    <script type="text/javascript" src="System.Security.Cryptography.HMACSHA1.js"></script>
    <script type="text/javascript" src="System.Security.Cryptography.js"></script>
    <script type="text/javascript" src="System.Security.Cryptography.RSA.js"></script>
    <script type="text/javascript" src="System.Security.Cryptography.SHA1.js"></script>
    <script type="text/javascript" src="System.Text.js"></script>

    <script type="text/javascript">
        $(document).ready(function () {
            alert("button");

        });
      //  debugger;
     //   var element = document.getElementById("btntest");

        //$("#btntest").click(function () {
        //    alert("button");
        //});

    </script>

</head>
<body>
    <input type="button" id="btntest" value="Test" />


    <span>Name:</span>
    <input type="text" id="txtName" />
    <br />
    <br />

    <input type="button" id="btnSend" value="Send" />




</body>
</html>

Any suggestions to resolve this would be really appreciated.

Share Improve this question asked Jul 3, 2015 at 8:25 G droidG droid 9666 gold badges14 silver badges38 bronze badges 2
  • 1 Aside from your issue, why did you include "Scripts/jsencrypt.min.js" and "Scripts/jsencrypt.js" twice? – TaoPR Commented Jul 3, 2015 at 8:29
  • @ Tao P. R.: I have removed those now..not using them anymore – G droid Commented Jul 3, 2015 at 9:23
Add a ment  | 

2 Answers 2

Reset to default 3

Have you tried using a CDN for example - https://code.jquery./jquery-1.11.3.min.js

I don't see any problem with the code as long as $ has been overwritten by any other reference below it. If the code does not work with CDN reference, you can also try adding the jquery reference at the end.

It was my bad.Changing the order of the jquery files did the trick. Added the reference of jquery and jquery.min files at the bottom of the other .js files. Might help some one as well.

   <script type="text/javascript" src="System.js"></script>
        <script type="text/javascript" src="System.IO.js"></script>
        <script type="text/javascript" src="System.BigInt.js"></script>
        <script type="text/javascript" src="System.BitConverter.js"></script>
        <script type="text/javascript" src="System.Convert.js"></script>
        <script type="text/javascript" src="System.Security.Cryptography.HMACSHA1.js"></script>
        <script type="text/javascript" src="System.Security.Cryptography.js"></script>
        <script type="text/javascript" src="System.Security.Cryptography.RSA.js"></script>
        <script type="text/javascript" src="System.Security.Cryptography.SHA1.js"></script>
        <script type="text/javascript" src="System.Text.js"></script>
     <script src="Scripts/jquery.js">

本文标签: javascriptUncaught TypeError Cannot read property 39ready39 of nullStack Overflow