html 部分代码:
<li id="aside_my" class="mui-table-view-cell">
<a class="mui-navigate-right">我的</a>
</li>
javascript 部分代码:
//错误代码
$('#aside_my').on('click', function() {
alert("我被点了");
});
click只针对button类控件好使,这是js的功能
而本例中 是 对 li 元素监听,所以 click失效,应该使用mui封装的 tap 来实现
所以javascript部分代码 ‘click’ 换成 ‘tap’就可以了,如下:
//正确代码
$('#aside_my').on('tap', function() {
alert("我被点了");
});