我在想我们能做的是,当他们只使用最低价格(价格来自)搜索并点击搜索时会显示消息,请填写最高预算。这是网站http://www.phpropertydeals.com,然后点击搜索分钟。最大,我们可以在(价格来自)中加价时,然后(价格到)将提示必填字段。但如果没有输入,则此部分将继续搜索。
<div class="mini-field">
<input input name="pricefrom" class="txt-field-input-mini formattingNumber" placeholder="Price from" style="width:159px;">
<input input name="priceto" class="txt-field-input-mini formattingNumber" placeholder="Price to" title="Please input maximum price budget" style="width:159px;">
</div>
<script type="text/javascript">
$(document).ready(function() {
var pricefrom = $('input[name="pricefrom"]');
$(pricefrom).on('click', function() {
if($('input[name="priceto"]').val().length < 1) {
alert("You must insert Maximum price!");
}
});
});
</script>
答案 0 :(得分:0)
类似的东西:
$( "#myform" ).submit(function( event ) {
event.preventDefault();
if($('input[name="priceto"]').val().length < 1) {
alert("You must insert Maximum price!");
} else {
$( "#myform" ).submit();
}
});
答案 1 :(得分:0)
将id分配给输入代码,如下面的代码
<input input name="priceto" class="txt-field-input-mini formattingNumber" placeholder="Price to" title="Please input maximum price budget" style="width:159px;" id="min">
</div>
<script type="text/javascript">
$(document).ready(function() {
$('#min').on('click', function() {
if($('input[name="priceto"]').val().length < 1) {
alert("You must insert Maximum price!");
}
});
});
</script>