简体   繁体   English

ie7不使用jquery执行加载的脚本

[英]ie7 does not execute loaded script with jquery

on my main page i have js function 在我的主页上,我有js函数

function loadNext(last){
    var index = parseInt($("#contentSupplier table tr:last td:first").html()) + 1;
    $.get("suppliernext.php?index=" + index + "&" + "last=" + last,      $("#supplierForm").serialize(), function(data){
        $("#contentSupplier table tr:last").after(data);

    });
}

and on page that is loaded suppliernext.php i have this code 并在页面上加载了vendornext.php我有此代码

<script>
    $("#loadnext").attr('onclick', 'loadNext(<?=$ps?>)');
<?php 
 if($i >= $rowcount)
{
    echo "$('#loadnext').hide();";
}
?>
</script>

this changes button on click function on the first page. 这会更改首页上的点击功能按钮。
ie7 executes this code but does not change the oncick function ie7执行此代码,但不更改oncick函数

in ie8 chrome and mozzila it is working correctly. 在ie8 chrome和mozzila中,它工作正常。 how can i make it work in ie7? 我怎样才能使它在ie7中工作?

Do not set onclick with attr! 不要使用attr设置onclick! Use on() 使用on()

$("#loadnext").off('click').on('click', function() {loadNext(<?=$ps?>);});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM