Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 需要知道如何在jquery onclick事件中添加条件_Javascript_Jquery_Triggers_Onclick_Lightbox - Fatal编程技术网

Javascript 需要知道如何在jquery onclick事件中添加条件

Javascript 需要知道如何在jquery onclick事件中添加条件,javascript,jquery,triggers,onclick,lightbox,Javascript,Jquery,Triggers,Onclick,Lightbox,我有这样的代码 $(document).ready( function() { if ($('#cancelorder').length) { $(".new_order_cancel").live( 'click', function(e) { e.preventDefau

我有这样的代码

$(document).ready(
        function() {
            if ($('#cancelorder').length) {
                $(".new_order_cancel").live(
                        'click',
                        function(e) {
                            e.preventDefault();
                            var rules;
                            href = $(this).attr("href");
                            $.ajax({
                                type : "GET",
                                url : href,
                                success : function(html) {
                                    $.ocBox(
                                            "<div class=\"orderCancelBox\">"
                                                    + html + "</div>", {
                                                autoDimensions : true
                                            });

                                }
                            });
                        });

            }
        }); 
$(文档)。准备好了吗(
函数(){
如果($('#取消订单')。长度){
$(“.new\u order\u cancel”).live(
“点击”,
职能(e){
e、 预防默认值();
var规则;
href=$(this.attr(“href”);
$.ajax({
键入:“获取”,
url:href,
成功:函数(html){
$.ocBox(
""
+html+“”{
自动标注:真
});
}
});
});
}
}); 

基本上,这会打开一个lightbox,但我想更改显示lightbox的逻辑,并根据onclick事件上的标志更改href,我如何才能做到这一点?

您要检查的条件是什么?在上使用
而不是
live
,这是不推荐使用的。您好,我只需要通过调用js函数进行日期/时间检查,如果函数返回false,我必须提交页面,而不是打开lightbox。