I have a jquery problem when using $.noConflict in master page
I had tried this in single page. I worked. But I try this 开发者_运维知识库in master page (dotnet), didnt work. Can u say that what about this problem.
============== aaaaaaaaaaaaaaaa.master page
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="aaaaaaaaaaaaaaaa.master.cs" Inherits="aaaaaaaaaaaaaaaa" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type='text/javascript' src="javascripts/jquery.min.js">
</script><script language="javascript" type="text/javascript">
$.noConflict();
</script>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</form>
</body>
</html>
============== bbbbbbbbbbbbbbbbbbbbbb.aspx page
<%@ Page Title="" Language="C#" MasterPageFile="~/aaaaaaaaaaaaaaaa.master" AutoEventWireup="true" CodeFile="bbbbbbbbbbbbbbbbbbbbbb.aspx.cs" Inherits="bbbbbbbbbbbbbbbbbbbbbb" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<script language="javascript" type="text/javascript">
function goster() {
alert(jQuery("#TextBox1").val());
}
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:TextBox ID="TextBox1" onBlur="goster();" runat="server"></asp:TextBox>
</asp:Content>
thanks to @Mahesh. Answer of this problem is;
in bbbbbbbbbbbbbbbbbbbbbb.aspx page
function goster() { alert(jQuery("#ContentPlaceHolder1_TextBox1").val()); }
精彩评论