通过jQuery的attr修改onclick

代码如下:

<!--<br/ /> <br/ /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br/ /> http://www.CodeHighlighter.com/<br/ /> <br/ /> --> varjs = " alert('B:'+this.id);returnfalse; " ;
// createsafunctionfromthe"js"string
varnewclick = eval( " (function(){ " + js + " }); " );
// clearsonclickthensetsclick
$( " #anchor " ).attr( ' onclick ' , '' ).click(newclick);

你可能感兴趣的:(onclick)