mycar += '<li class="mui-table-view-cell" data-id="'+i+'">'
+ '<div class="mui-table">'
+ '<div class="mui-table-cell mui-col-xs-10">'
+ '<label>车的名称: '+list.CAR_NAME+'</label><br />'
+ '<label>车牌号码: '+list.CAR_NUMBER+'</label><br />'
+ '<label>车的型号: '+list.CAR_MODEL+'</label>'
+ '<h4>'
+ '<button id="delete" type="button" class="mui-btn" style="float: right;margin-right: 1%;" onclick="delCar('+list.CAR_ID+')">删除</button>'
+ '<button type="button" id="updatecar" class="mui-btn mui-btn-danger" style="float: right;margin-right: 5%;background-color: #FF999A;border: 0 solid;">修改</button>'
+ '</h4>'
+ '</div>'
+ '</div>'
+ '</li>'
mui('#myCarContent').on('tap','li',function(){ }); 怎么把事件分别绑定到删除按钮 修改按钮上。
1 个回复
傻吊
给修改和删除都给一个id,或者class不同
如果id分别为p1 p2
mui('#myCarContent').on('tap','#p1',function(){ });
mui('#myCarContent').on('tap','#p2',function(){ });
如果class分别为mymui_1 mymui_2
mui('#myCarContent').on('tap','.mymui_1',function(){ });
mui('#myCarContent').on('tap','.mymui_2',function(){ });