我打算使用jQuery mobile此一個拿到手機主題http://jsfiddle.net/hhken790/jQuery Mobile的加/減問題
HTML
<input type="button" value="-" class="qtyminus" />
<input type="text" name="myInputs[qty][]" value="0" class="qty" />
<input type="button" value="+" class="qtyplus" />
jQuery的
$("#dynamic").on("click", ".qtyplus", function (e) {
e.preventDefault();
var $input = $(this).prev("input");
var currentVal = parseInt($input.val());
if (!isNaN(currentVal)) {
$input.val(currentVal + 1);
} else {
$input.val(0);
}
});
然而,加和減去不會在這裏工作。任何想法是什麼造成這個?
是否在Chrome瀏覽器?是否應用了移動主題。對我來說,它不適用於Chrome – Andreas