JQuery无法正常运行 [英] JQuery not Running Properly
本文介绍了JQuery无法正常运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我对ASP.Net较新.我在ASP.Net(C#)项目中加载DatePicker时遇到问题.它甚至不显示无法加载脚本"之类的错误....它只是保持静态.
我的代码如下...请帮帮我
Im newer to ASP.Net . I have an problem in loading DatePicker in my ASP.Net(C#) project. Its not even shows errors like "Cannot load Script".... its just remains static.
My code is below... Please help me out
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<link href="../../StyleSheets/_Scripts/smoothness/jquery-ui-1.7.1.custom.css" rel="stylesheet" type="text/css" />
<script src="../../StyleSheets/_Scripts/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="../../StyleSheets/_Scripts/jquery-ui-1.7.1.custom.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$("#txt_AppointDate").datepicker({ dateFormat: 'dd/mm/yy', showSpeed: 'fast' });
});
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Adminmaster" Runat="Server">
<strong>Appointment Date :</strong>
<asp:TextBox ID="txt_AppointDate" runat="server"></asp:TextBox>
我还需要添加其他内容吗?
请指导我....
Am i need to include anything else???
Please guide me....
推荐答案
(function(){
(function() {
(#txt_AppointDate").datepicker({ dateFormat:"dd/mm/yy",showSpeed:"fast"}); }); < /script >
("#txt_AppointDate").datepicker({ dateFormat: 'dd/mm/yy', showSpeed: 'fast' }); }); </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Adminmaster" Runat="Server">
<strong>Appointment Date :</strong>
<asp:TextBox ID="txt_AppointDate" runat="server"></asp:TextBox>
我还需要添加其他内容吗?
请指导我....
Am i need to include anything else???
Please guide me....
实际上,这里的问题是带有JQuery的母版页",呈现页面时控件ID发生了更改(如果您使用的是母版页).我认为您需要使用Control.ClientID
属性.
尝试这个.它会起作用.
Actually here the problem is ''Master Page with JQuery'', Control Id''s are Changed when the page is rendered(if you used Master Page). I think you need useControl.ClientID
Property.
Try this. it will works.
<script type="text/javascript">
这篇关于JQuery无法正常运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文