这个jQuery onclick功能在所有计算机浏览器中都能很好地运行,但是当在Android移动设备上运行时#39;默认浏览器它没有。它可以在Chrome移动浏览器中使用。
<input type="button" value="Add" id="submit" class="btn btn-primary"/>
<div class="table-responsive " style= "max-width:900px;">
<table class="table table-bordered">
<thead>
<tr>
<th style="width:20px">#</th>
<th>code</th>
<th>credit</th>
<th>Grade</th>
</tr>
</thead>
<tbody class="tableBody">
</tbody>
</table>
</div>
$(document).ready(function() {
var i=0;
var code;
var credit=0;
var grade=0;
$('#submit').click(function (){
i=i+1;
code=$('input[name=codeInput]').val();
credit=$('select[name=quantity]').val();
grade=$('select[name=gradetInput]').val();
$('.tableBody').append( '<tr class="trow">'+'<td>' + i +'</td>'+'<td>' + code +'</td>'+'<td>' + credit +'</td>'+'<td>' + grade +'</td>'+'</tr>');
});
});
答案 0 :(得分:1)
尝试使用touchstart,如下所示:
$('#submit').bind('touchstart click', function(){
i=i+1;
code=$('input[name=codeInput]').val();
credit=$('select[name=quantity]').val();
grade=$('select[name=gradetInput]').val();
$('.tableBody').append( '<tr class="tenter code hererow">'+'<td>' + i +'</td>'+'<td>' + code +'</td>'+'<td>' + credit +'</td>'+'<td>' + grade +'</td>'+'</tr>');
});
答案 1 :(得分:0)
https://github.com/ftlabs/fastclick
$(function() {
FastClick.attach(document.body);
});
获利,但你的代码中i
是什么?
答案 2 :(得分:0)
不确定这是一个问题,但请尝试添加此规则:
.dropdown-backdrop {
z-index: -1;
}