Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/378.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/82.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 实时(';单击';不工作,但。单击(在IE 8中工作_Javascript_Jquery_Ajax - Fatal编程技术网

Javascript 实时(';单击';不工作,但。单击(在IE 8中工作

Javascript 实时(';单击';不工作,但。单击(在IE 8中工作,javascript,jquery,ajax,Javascript,Jquery,Ajax,我使用的是jquery 1.3.2版。我面临一个奇怪的问题。在IE9中,我的应用程序运行良好,但在IE8中,此功能不起作用 jQuery('.mutulafriends').live('click',function(){}); 我只是在这个函数中添加了一个警报,但它不起作用,似乎它没有识别单击。在控制台中我可以看到一个错误 SCRIPT87: Invalid argument. jquery-1.3.2.min.js, line 12 character 12949 当我在警报中使用此功

我使用的是
jquery 1.3.2版
。我面临一个奇怪的问题。在IE9中,我的应用程序运行良好,但在IE8中,此功能不起作用

jQuery('.mutulafriends').live('click',function(){});
我只是在这个函数中添加了一个警报,但它不起作用,似乎它没有识别
单击
。在控制台中我可以看到一个错误

SCRIPT87: Invalid argument. 
jquery-1.3.2.min.js, line 12 character 12949
当我在警报中使用此功能时

jQuery('.mutulafriends').click(function(){
    alert("");
});
工作正常。但错误也显示为:

SCRIPT87: Invalid argument. 
jquery-1.3.2.min.js, line 12 character 12949
似乎错误没有影响
单击
。我知道jquery 1.3.2版
live('change'
不起作用,但为什么
live('clck'
不起作用?有什么想法,请帮助。提前谢谢。这是我的HTML。可能太长了,但我认为可能会有帮助

        <div class="component-list-wrapper">

        <?php if(is_array($result) && count(array_filter($result)) > 0) {
            foreach($result as $record) {
                ?>

            <div class="eliment-component-list eliment-divider">
                <div class="user-profile-img-holder">
                    <img alt="Profile image"
                        src=<?php if(isset($record['ProfileImg'])){echo $img_url.md5($record['ProfileID'])."/default/".$record['ProfileImg'];}else{echo $this->config->item('ivory_img_path')."/thumb-img.png";} ?> />
                </div>
                <div class="user-des-container">
                    <div class="user-des-left">
                        <div class="namecontainer">
                            <label class="darkcolour-large"><?php echo $record['FirstName']; if($record['PrivacySettingFriend']){echo " ".$record['LastName'];} ?></label> <label
                                class="lblsub"><?php echo $record['StateName'].', '.$record['CityName']; ?></label>
                        </div>
                        <div class="friendcontainer">
                            <label img_url="<?php echo $img_url; ?>" req_type="recieved" friend_id="<?php echo $record['ProfileID']; ?>" class="darkcolour margine-top20 mutulafriends btndialogMutualFriends"><?php if(!isset($record['CommonFriendCount'])){echo "0 Friends in Common";}else if($record['CommonFriendCount']!=1){echo  $record['CommonFriendCount']."  Friends in Common";}else{echo  $record['CommonFriendCount']."  Friend in Common";} ?></label>
                        </div>
                    </div>
                    <div class="user-des-right">
                        <div class="user-des-right-inner">
                            <img width="13" height="13" class="btnDialogDelete request_del_dialog_open_but" req_type="recieved" prof_friend_id="<?php echo $record['ProfileFriendID']; ?>"
                                src="<?php echo $this->config->item('ivory_img_path'); ?>close_button.png"
                                alt="Profile image">
                            <div class="button-wrapper">
                                <input type="button" class="btnRequest btn-white-small request_accept_dialog_open_but" name="" prof_friend_id="<?php echo $record['ProfileFriendID']; ?>"
                                    tabindex="123456" value="Accept">                                       
                            </div>
                            <div class="button-wrapper">
                                <input type="button" class="btnDialogAssign btn-grey-small request_decline_dialog_open_but" prof_friend_id="<?php echo $record['ProfileFriendID']; ?>" 
                                    name="" tabindex="123456" value="Decline">                                  
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <?php }
        } else {?>

            <div class="no-records-found">No records found</div>

            <?php } ?>

        </div>

配置->项目('ivory\u img\u path')。“/thumb img.png”;}?>/>

您的类“mutulafriends”不需要动态绑定,所以我认为“click”就足够了

把它包起来

$(document).ready(function(){
         jQuery('.mutulafriends').click(function(){
           alert('And update your JQuery to the latest one :=)');

       });
});
//委托方法

$(document).ready(function(){
             jQuery('div.component-list-wrapper').delegate('.mutulafriends','click',function(){
               alert('And update your JQuery to the latest one :=)');

           });
    });

Live或delegate方法仅用于LateBinding,这意味着页面加载后生成的元素,例如通过ajax调用生成的元素。请尝试使用最新的jQuery。这可能会解决您的问题。该版本中可能存在一些bug/缺陷,这些缺陷本可以在以后的jQuery版本中解决

此答案的当前版本为1.7.2和,其替换版本为


另外,我几乎假设您完全依赖于结束错误警报,它最终会出现在jQuery库中。它的信息量不大。请检查堆栈跟踪,以检查错误可能来自何处。尝试添加断点,以了解执行的特定部分的值。我对jQuery有信心,它可能只是e您为它提供了一些错误的值。请检查是否有拼写错误。

不,实际上这也有分页功能。因此元素是动态创建的。这也是$(document).ready(function()。我的问题是为什么live('click'不起作用?
.live()
单击一起使用
在jQuery 1.3.2中运行良好:必须有其他东西被视为
无效参数
。错误指向的第12行到底是什么。出于好奇,为什么要使用1.3.2而不是最新的1.7.1?