点击事件不会在jquerry弹出窗口中触发 [英] On click event is not firing in jquerry popup

查看:88
本文介绍了点击事件不会在jquerry弹出窗口中触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试点击jquerry代码中的按钮。但onclick事件没有解雇。下面粘贴的代码

尝试跟随他们不工作

$('#<%= hidButton.ClientID%>')。click();



document.getElementById('<%= hidButton.ClientID%>')。click();



$([id * = Button1])。click();















try to click on a button from jquerry code. but onclick event is not firing. the code i pasted below
tried following non of them work
$('#<%=hidButton.ClientID%>').click();

document.getElementById('<%=hidButton.ClientID%>').click();

$("[id*=Button1]").click();







<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="demo.aspx.cs" Inherits="Stage1.demo" %>

<!DOCTYPE html>

<<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
    <script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/jquery-ui.js" type="text/javascript"></script>
    <link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/themes/start/jquery-ui.css" rel="stylesheet" type="text/css" />
    <title></title>
</head>
<body>
    <form id="form1" runat="server">

    
<script type="text/javascript">
    $("[id*=btnModalPopup]").live("click", function () {
        
        $("#modal_dialog").dialog({
            title: "Select The Format You Wanted",
            height: 300,
            width: 400,
            buttons: {
                'Select All': select,
                Save: save,
                Cancel: cancel,
                Testclick: Testclick
                
        
            },
            modal: true
        });
        
        return false;
    });
    function Testclick() {
        
        
        var clickButton = document.getElementById("<%= test.ClientID %>");
        clickButton.click();
        
    }
    function select() {
        $(':checkbox').prop('checked', true);
    }
    function save() {
        
        $(this).dialog('close');
    }

    function cancel() {
        
        $(this).dialog('close');
        $(':checkbox').prop('checked', false);
    }




 






</script>
<div id="modal_dialog" style="display: none">
    
   PDF <asp:CheckBox ID="CheckBox1" runat="server" />
   WORD <asp:CheckBox ID="CheckBox2" runat="server" />
   CSV <asp:CheckBox ID="CheckBox3" runat="server" />
    XL<asp:CheckBox ID="CheckBox4" runat="server" />
   XML <asp:CheckBox ID="CheckBox5" runat="server" /><br />
      
</div>
 <asp:Button ID="test" runat="server" Text="Button"  OnClick = "Button1_Click" />
      
<asp:Button ID="btnModalPopup" runat="server" Text="Test" />


    </form>
</body>
</html>





我的尝试:



尝试跟随他们不工作

$('#<%= hidButton.ClientID%>')。click();



document.getElementById('<%= hidButton.ClientID%>')。click();



$([id * = Button1])。click();



What I have tried:

tried following non of them work
$('#<%=hidButton.ClientID%>').click();

document.getElementById('<%=hidButton.ClientID%>').click();

$("[id*=Button1]").click();

推荐答案

('#<%= hidButton.ClientID%>')。click();



document.getElementById('<%= hidButton.ClientID%>')。click() ;


('#<%=hidButton.ClientID%>').click();

document.getElementById('<%=hidButton.ClientID%>').click();


([id * = Button1])。click();















("[id*=Button1]").click();







<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="demo.aspx.cs" Inherits="Stage1.demo" %>

<!DOCTYPE html>

<<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
    <script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/jquery-ui.js" type="text/javascript"></script>
    <link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/themes/start/jquery-ui.css" rel="stylesheet" type="text/css" />
    <title></title>
</head>
<body>
    <form id="form1" runat="server">

    
<script type="text/javascript">


[id * = btnModalPopup]) .live( 点击功能 (){
("[id*=btnModalPopup]").live("click", function () {


这篇关于点击事件不会在jquerry弹出窗口中触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆