我对Java语言完全陌生。
我有一个要用Java实时搜索过滤的邮政编码的数据库。
这是我的代码:
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('.search-box input[type="text"]').on("keyup input", function(){
/* Get input value on change */
var inputVal = $(this).val();
var resultDropdown = $(this).siblings(".result");
if(inputVal.length){
$.get("lookup.php", {term: inputVal}).done(function(data){
// Display the returned data in browser
resultDropdown.html(data);
});
} else{
resultDropdown.empty();
}
});
// Set search input value on click of result item
$(document).on("click", ".result p", function(){
$(this).parents(".search-box").find('input[type="text"]').val($(this).text());
$(this).parent(".result").empty();
});
});
</script>
这3个字段分别是一个“选择字段”,一个带有文本的“输入字段”和一个带有数字的“输入字段”。
如何更改Js代码以获取实时搜索的所有3个搜索字段?