jquery没有';无法在第二次加载webuser控件时工作

jquery没有';无法在第二次加载webuser控件时工作,jquery,telerik,webusercontrol,Jquery,Telerik,Webusercontrol,这是webuser控件中的html代码 <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0" Width="100%"> <telerik:RadPageView ID="RadPageView1" runat="server"> <link rel="stylesheet" href="http://code.jquery.com

这是webuser控件中的html代码

    <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0" Width="100%">
        <telerik:RadPageView ID="RadPageView1" runat="server">

        <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
        <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
        <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
        <script type="text/javascript">
            $(function (){
            $('#btn_jquerycall').button().click(function () {
                alert("Comming Soon!");
            });
        });
    </script>
        <fieldset>
            <div style="margin-top: 10px; margin-left: 10px;">
                <span style="font-weight: bold;">
                    <asp:Literal runat="server" ID="lblSubject" />
                </span><span style="font-style: italic;">
                    <asp:Literal runat="server" ID="lblDate" Text=" - {0:dd/MM/yyyy}" />
                </span>
            </div>
            <div class="event">
                <asp:Literal runat="server" ID="lblContent" />
            </div>
        </fieldset>
        <div>
            <telerik:RadButton ID="telerik_button" runat="server" Text="Telerik Button" 
                    Height="35">
                    <Icon PrimaryIconUrl="~/Images/iconGreen.png" PrimaryIconWidth="32" PrimaryIconHeight="32"
                        PrimaryIconCssClass="PrimaryIcon" />
                </telerik:RadButton>
                <input id="btn_jquerycall" type="button" value="Alert Jquery"/>
        </div>
    </telerik:RadPageView>
</telerik:RadMultiPage>

$(函数(){
$('#btn_jquerycall')。按钮()。单击(函数(){
警惕(“马上就要来了!”);
});
});
问题是,当我第一次加载此页面时,当我单击btn_jquerycall按钮时,Jquery工作得很好,这意味着调用了警报。但是当我点击telerik_按钮时,这个webuser控件被加载,在第二次加载时,当我再次点击btn_jquerycall时,jquery没有调用,因为我试图将btn_jquerycall移到RadMultipage之外


如何在第二次加载时使用jquery?需要帮助….

请尝试将以下功能放入脚本标记中:

$(document).ready(function(){
   var $button = $('#btn_jquerycall');
    $button.button();
   if(typeof $button === undefined)
       alert('Button not founded');
   else
       $button.on('click', function(){
           alert('Comming soon');
       });
});
如果页面加载后出现“Button not founded”(按钮未建立)警报,则表示页面未正确加载。如果它确实存在于您的页面中,它应该可以工作

编辑:


试试下面的内容。

你应该这样写

$(function (){
    $('#btn_jquerycall').click(function () {
        alert("Comming Soon!");
    });
});
或者你可以这样使用它

$(document).ready(function (){
    $('#btn_jquerycall').click(function () {
        alert("Comming Soon!");
    });
});
试试这个:

脚本代码应位于RadCodeBlock标记中RadMultiPage之外,如下所示:

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
    $(document).ready(function (){
        $("#<%=btn_jquerycall.Client%>").click(function () {
            alert("Comming Soon!");
        });
    });
 </script>
</telerik:RadCodeBlock>

$(文档).ready(函数(){
$(“#”)单击(函数(){
警惕(“马上就要来了!”);
});
});

当我单击btn\u jquerycall时,在第一次加载时没有调用任何警报,也没有调用警报。。。。css对btn_jquerycall也没有影响,我认为当jquery的css影响到btn_jquerycall时,会调用alert…在我的情况下,使用这种方式jquery在第一次也可以很好地工作,但是btn_jquerycall的css不起作用…第二次输入字段的id是什么我将
$(“#”)更改为
$(“#btn_jquerycall.Client”)
因为这是输入html。它只是第一次发出警报,第二次不会发生任何事情。id与第一次相同…此项目使用webuse RCControl,当我单击telerik_按钮时,整个webuser控件已加载,css在第二次加载时未影响btn_jquerycall..请参阅我的答案此处的问题是asyc call未加载脚本