Although it is not recommended to write such code in many cases, such code may be encountered in some cases. In some cases, you may need to modify the onclick attributes as follows: $ (& quot; id & quot;) attr (& quot; onclick & quot;, url ); such code, in chrome and firefox
Although it is not recommended to write such code in many cases, such code may be encountered in some cases.
In some cases, you may need to modify the onclick attribute as follows:
$ ("# Id"). attr ("onclick", url );
Such code can get the desired result in chrome and firefox.
Unfortunately, in ie, at least ie7 is ineffective, and i8 seems ineffective.
The method is to bind with jquery.
$ ("# Id"). attr ("onclick", ""). click (function (){//});
Here, you need to clear the value of The onclick attribute and then bind it to the display.
If the onclick attribute is not set, you do not need to clear it.
$ ("# Id"). click (funciton (){//});