0

on my main page i have js function

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

<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

in ie8 chrome and mozzila it is working correctly. how can i make it work in ie7?

1
  • By the way, always use parseInt with the base 10: parseInt(value, 10) - there are input strings that are not interpreted with base 10... e.g. parseInt("010") is 8! Commented Feb 7, 2013 at 18:01

1 Answer 1

1

Do not set onclick with attr! Use on()

$("#loadnext").off('click').on('click', function() {loadNext(<?=$ps?>);});
Sign up to request clarification or add additional context in comments.

1 Comment

You might want to .off('click') first so you don't fire multiple loadNextes

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.