EasyUI之搜索框searchbox

时间:2022-09-13 00:15:04

1、实例背景

     EasyUI中searchbox搜索框,输入值后点击搜索图标,可以打印出值


2、实例源码

<!DOCTYPE html><html>
<head>
<meta charset="UTF-8">
<title>EasyUI之搜索框searchbox</title>
<link rel="stylesheet" href="../themes/black/easyui.css" />
<link rel="stylesheet" href="../themes/icon.css" />
<link rel="stylesheet" href="../css/demo.css" />
<script type="text/javascript" src="../js/jquery.min.js" ></script>
<script type="text/javascript" src="../js/jquery.easyui.min.js" ></script>
<script>
$(document).ready(function(){
$("#searchBtn").click(function(){
var search = $('#searchBox').searchbox('menu');
console.dir(search);
});
});

function doSearch(value){
alert('您输入的值是: ' + value);
}
</script>
</head>
<body>
<div class="easyui-panel" style="width:100%;height:600px;padding:10px;">
<input id="searchBox" class="easyui-searchbox" data-options="prompt:'请输入值',searcher:doSearch" style="width:100%">
</div>
<div>
<button id="searchBtn">查询</button>
</div>
</body>
</html>

3、实例结果

(1)初始化

EasyUI之搜索框searchbox

(2)点击图标

EasyUI之搜索框searchbox