< /li>
Although writing this way is not recommended in many cases, there are still times when you will encounter such code.
Then you may need to modify the onclick attribute at some point as follows:
$("#id").attr("onclick",url);
Code like this can get what you want in chrome and firefox result.
Unfortunately, in IE, at least IE7 and below have no effect. As for i8, it seems to have no effect.
The way is to use jquery binding.
$("#id").attr("onclick","").click(function(){
//
});
You need to clear onclick here first The value of the attribute is displayed after binding.
If the onclick attribute has not been set, there is no need to clear it.
$("#id").click(funciton(){
//
});
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn