var js = "alert('B:' + this.id); return false;"; // creates a function from the "js" string var newclick = eval("(function(){"+js+"});"); // clears onclick then sets click $("#anchor").attr('onclick', '').click(newclick);
来源:changing the value of onclick with or without jQuery
Powered by: 博客园 Copyright © 2024 shenyixin Powered by .NET 8.0 on Kubernetes