To dynamically change The onclick function in the previous page. I have tried many methods and have not made them. The following are examples of failures. If you need them, refer to how jquery sets the onclick event of the button input? For example, there is a button at the beginning: This line of code is generated in the background of the program, and Discuz! In the same way as in the source code of the NT Forum, all things and scripts on the page are generated by the background code .. then use jquery. load ajax to the page .. others except ie8 cannot be displayed .. other browsers are normal. now the problem is: to dynamically change The onclick function in the previous page button. I tried many methods and did not make them. The following are examples of failure:
1. JavaScript code:
The Code is as follows:
$ ("# Prebt "). unbind ("onclick", function () {var p = $ ("# nextbt "). parent (); $ ("# nextbt "). remove ();
P. append ("")});
JavaScript code:
$ ("# Prebt"). removeAttr ("onclick ");
$ ("# Prebt"). attr ("onclick", "ToPage (4 )");
Or:
$ ("# Prebt"). attr ("onclick ","");
$ ("# Prebt"). attr ("onclick", "ToPage (4 )");
2. JavaScript code:
The Code is as follows:
$ ("# Prebt"). removeAttr ("onclick ");
$ ("# Prebt"). click (function () {ToPage (4)}); // This sentence will lead to an endless loop... I don't know what's going on ..
// My paging function... In this way, data is constantly jumping. How can this problem be solved?
There is really no way to do it. I can only post related requests on the Internet. A friend asked me if I want the following results:
The Code is as follows:
$ ("# Prebt"). unbind ("onclick ");
$ ("# Prebt"). bind ("onclick", "ToPage (4 )");
In fact, the effect I want is the same as above, but the above method is similar to my original effect, and cannot be executed, and cannot be bound at all.
Another enthusiastic user gave me a code example, saying it was helpful to me. The details are as follows:
XML/HTML code:
The Code is as follows:
Untitled document