我有某種商店。 1條帶過濾器,1條帶物品。 過濾器欄具有輸入字段起始和終止價格 它看起來像這樣當它不應該變成真時,它變成了真的
<input id="pricefrom" type="text" placeholder="Min" style="position:relative; float: left; width:100px;">
<input id="priceto" type="text" placeholder="Max" style="position:relative; float: right; width:100px;">
而且腳本時用戶集中的是處理輸入:
$("#pricefrom").focusout(function() {
var from = $("#pricefrom").val();
var to = $("#priceto").val();
console.log("from: "+from);
console.log("to: "+to);
if(from > to){
$('#pricefrom').val(to);
from = to;
console.log("from > to");
}
drawItems(from, to);
});
$("#priceto").focusout(function() {
var from = $("#pricefrom").val();
var to = $("#priceto").val();
console.log("from: "+from);
console.log("to: "+to);
if(to < from){
$('#priceto').val(from);
to = from;
console.log("to < from");
}
drawItems(from, to);
});
如果用戶把以上的價格大於TO,是使其成爲均勻。輸入「150-50」=>「150-150」
但它碰巧只能正常工作1次。然後例如它具有「200-200」值。我把從價格來糾正50的價值。它從「50」到「200」「從」到「」並且使得等於200.但是它更低,地獄(從>到)如何成爲真實?
Sry英語差。
Daaamn,當然是。我聽說過並忘記了。我是新來的編碼,所以... 工作就像一個魅力。非常感謝你 – ikebastuz