我在 http://dev.jtsage.com/jQM-DateBox2/demos/fullopt.html 使用 jquery mobile datebox 特别是我在http://dev.jtsage.com/cdn/datebox/ 使用 calbox选项1.1.0/jqm-datebox-1.1.0.mode.calbox.js
我需要拦截当您单击某一天时触发的单击事件,然后执行一些自定义操作(例如更改该日期的背景颜色)。这样做的最佳方法是什么?我尝试为元素 $('div.ui-datebox-griddate.ui-corner-all.ui-btn-up-d') 注册一个单击事件,但这似乎不起作用。
我正在使用backbonejs,并且coffeescript中类的相关部分看起来像(SimpleView扩展Backbone.View):
class A extend SimpleView
....
events: {
'click div.ui-datebox-griddate.ui-corner-all.ui-btn-up-d': "clicked"
}
clicked: (event) ->
console.log 'clicked'
上面的方法不起作用,而且这可能不是做我想做的最好的方法,因为它依赖于内部类名来创建点击事件。
提前致谢!