使用$ .noConflict时出现jQuery问题

问题描述:

我必须在我的项目中使用noConflict方法.但是我对此有疑问. 如果我不使用此方法,则项目运行正常. 但是,如果我使用此方法,则会出现错误.我该如何解决这个问题.

Hi I have to use noConflict method in my project. But I have a problem about this. İf I dont use this method, project is working correctly. But if I use this method, I have a error. How can I solve this problem.

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
  <title></title>
  <script type='text/javascript' src="javascripts/jquery.min.js"></script>
  <script type="text/javascript">
    $.noConflict(); // İf I dont use this method, project is working correctly.
                    // But if I use this method, I  have a error 
  </script>
  <script language="javascript" type="text/javascript">
    function goster() {
        alert($("#TextBox1").val());
    }
  </script>
</head>
<body>
  <form id="form1" runat="server">
    <asp:TextBox ID="TextBox1" onBlur="goster();" runat="server"></asp:TextBox>
  </form>
</body>
</html>

如果使用$.noConflict();,则应使用jQuery而不是$.

If you use $.noConflict(); then you should use jQuery instead of $.

<script language="javascript" type="text/javascript">
    function goster() {
        alert(jQuery("#TextBox1").val());
    }
  </script>

请参阅演示. http://jsfiddle.net/UnUgP/3/