我正在开发一个google chrome扩展。我尝试在现有网页的jquery-ui对话框中使用jquery-ui datepicker (内容级别)
像这样:Screenshot
当我点击datepicker小部件的任何按钮时,我会得到"DP_jQuery_1274168529407 is not defined“,我认为这是因为jquery datepicker在html上添加了:
onclick="DP_jQuery_1274192751418.datepicker._selectDay('#new\\-app\\-date',4,2010, this);return false;"这意味着我必须更改datepicker库以避免修改html,而是像这样在每个obj上附加一个事件:
.click(function(){DP_jQuery_1274192751418.datepicker._selectDay('#new\\-app\\-date',4,2010, this);return false;})这可能会保证作用域的安全。
你认为如何?
发布于 2010-05-20 22:21:27
我的haxorz技能再次占上风!
修改函数_updateDatepicker中8307行的jquery-ui.js代码,插入:
.find('[onclick]').each(function(){
var command = $(this).attr('onclick')+'';
$(this).removeAttr('onclick');
command = command.replace("function onclick(event) {","");
command = command.substr(0, command.length-2);
$(this).click(function(){eval(command);});
})
.end()将会解决这个问题。
我知道它很难看,我知道它可以用更少的代码行来完成,但它只是暂时的,直到jquery ui团队解决了这个问题
https://stackoverflow.com/questions/2855403
复制相似问题