我在这里跟踪的时间比我记得的要长,这是我的第一篇文章,所以我希望我做对了。我希望能够有一个最低和最高价格下拉菜单,并且当有人选择最低价格时,它会使用所选的最小值自动更新最高价格。到目前为止,这是我的代码......(取自其他人之前的帖子,但我可以让它正常工作。它在理论上工作,但如果我选择说 90,000.00 英镑,它会删除包含小于 9 的数字的所有内容.
我想我需要知道如何让 Javascript 将其视为数字/数字,因此它知道 110000 高于 90000
$(window).load(function(){
var maxprice = $('#maxprice').html();
$('#minprice').change(function() {
$('#maxprice').html(maxprice);
$('#maxprice option').each(function() {
if ($(this).val() <= $('#minprice').val()) $(this).remove();
});
});
});
<div><select name="minprice" class="searchboxes" id="minprice">
<option value="0">No Minimum</option>
<?php for ($n = 10000; $n <= 250000; $n += 10000) { ?>
<option value="<?php echo $n; ?>"><?php echo number_format($n, 2, '.', ','); ?> </option><?php } ?>
<?php for ($n = 275000; $n <= 500000; $n += 25000) { ?>
<option value="<?php echo $n; ?>"><?php echo number_format($n, 2, '.', ','); ?> </option><?php } ?>
<?php for ($n = 550000; $n <= 1000000; $n += 50000) { ?>
<option value="<?php echo $n; ?>"><?php echo number_format($n, 2, '.', ','); ?> </option><?php } ?>
<?php for ($n = 1100000; $n <= 2500000; $n += 100000) { ?>
<option value="<?php echo $n; ?>"><?php echo number_format($n, 2, '.', ','); ?> </option><?php } ?>
<?php for ($n = 3000000; $n <= 5000000; $n += 250000) { ?>
<option value="<?php echo $n; ?>"><?php echo number_format($n, 2, '.', ','); ?> </option><?php } ?>
<?php for ($n = 5000000; $n <= 15000000; $n += 500000) { ?>
<option value="<?php echo $n; ?>"><?php echo number_format($n, 2, '.', ','); ?> </option><?php } ?></select></div>
<div><select name="maxprice" class="searchboxes" id="maxprice">
<option value="0">No Maximum</option>
<?php for ($n = 10000; $n <= 250000; $n += 10000) { ?>
<option value="<?php echo $n; ?>"><?php echo number_format($n, 2, '.', ','); ?> </option><?php } ?>
<?php for ($n = 275000; $n <= 500000; $n += 25000) { ?>
<option value="<?php echo $n; ?>"><?php echo number_format($n, 2, '.', ','); ?> </option><?php } ?>
<?php for ($n = 550000; $n <= 1000000; $n += 50000) { ?>
<option value="<?php echo $n; ?>"><?php echo number_format($n, 2, '.', ','); ?> </option><?php } ?>
<?php for ($n = 1100000; $n <= 2500000; $n += 100000) { ?>
<option value="<?php echo $n; ?>"><?php echo number_format($n, 2, '.', ','); ?> </option><?php } ?>
<?php for ($n = 3000000; $n <= 5000000; $n += 250000) { ?>
<option value="<?php echo $n; ?>"><?php echo number_format($n, 2, '.', ','); ?> </option><?php } ?>
<?php for ($n = 5000000; $n <= 15000000; $n += 500000) { ?>
<option value="<?php echo $n; ?>"><?php echo number_format($n, 2, '.', ','); ?> </option><?php } ?>
</select></div>
先感谢您。