当前位置:网站首页>EasyUI监听鼠标按下事件&监听键盘事件【简单详细】
EasyUI监听鼠标按下事件&监听键盘事件【简单详细】
2022-06-21 06:28:00 【泊云V】
EasyUI监听鼠标按下事件&监听键盘事件【简单详细】
自己在维护一个前辈写的代码时,需求在
按下鼠标时,触发指定功能操作
注意!~(说明下click和mousedown以及mouseup事件)
mousedown:鼠标按下时监听事件
mouseup: ~~~ 鼠标弹起事件监听
click: ~~~~~~ 是上面的两个mousedown和mouseup结合体,鼠标按下弹起监听事件
好了!~话不多说.上核心代码:
--js事件
$('#sbProduct').searchbox('textbox').bind('mousedown',function () {
_WoID = '';
$("#txtProductName").val("");
xAlert("鼠标按下操作成功");
return;
});
--如果是click
//====================================================================
//添加点击时的判断操作
//====================================================================
$('#sbProduct').searchbox('textbox').click(function () {
_WoID = '';
$("#txtProductName").val("");
xAlert("鼠标click事件成功");
});
--捆绑的HTML
<div id="divSbProduct" style="width: 100%">
<input id="sbProduct" class="easyui-searchbox" style="width: 100%; min-width:120px; max-width:270px; " onclick="sbProductClick()"
data-options="searcher:ShowProductPopup, inputEvents: $.extend({}, $.fn.searchbox.defaults.inputEvents, { keyup: function(e) { } } )" />
<%--$('#txtProduct').textbox('setText', ''); $('#txtProductName').textbox('setText', '');--%>
</div>
<div id="divTxtProduct" style="width: 100%; ">
<input id="txtProduct" class="easyui-textbox-border" style="width: 100%; min-width:120px; max-width:270px; border: none; " readonly="readonly" />
</div>
补充:监听所有键盘点击事件
//$('#sbProduct').val('').bind('keydown', function (e) {
$('#sbProduct').searchbox('textbox').keyup(function (e) {
//숫자, 영문자, 백스페이스, 스페이스
if ((e.keyCode >= 48 && e.keyCode <= 90) || (e.keyCode >= 96 && e.keyCode <= 105) || e.keyCode == 8 || e.keyCode == 32) {
$("#txtProductName").val("");
xAlert("键盘监听操作成功");
return;
}
});
补充2参考链接
$(function () {
//实时监听
$("#searchText").searchbox('textbox').bind('keyup',function(){
var searchVal=$("#searchText").next().children().val();
console.log(searchVal);
if(searchVal==""){
}
});
//焦点进入的事件
$("#searchText").searchbox('textbox').bind('focus',function(){
console.log('focus');
});
});
<input class="easyui-searchbox" data-options="searcher:enterKey,prompt:'请输入需要搜索的菜单名'"
id="searchText" onchange="showMenus" style="width: 215px; height: 32px;">
写这篇,今天六一,祝大家节日节日快乐!!哈哈~

边栏推荐
- 数据可视化实战:数据处理
- FPGA - 7 Series FPGA selectio -01- introduction and DCI technology introduction
- [JDBC from starting to Real combat] JDBC Basic clearance tutoriel (Summary of the first part)
- Contos7 installing SVN server
- Sqlmap命令大全
- leetcode数据库mysql题目(难度:简单)
- MSF内网渗透
- Issue 7: roll inside and lie flat. How do you choose
- 端午节-简单侧边导航栏
- Xshell7 connects to the server remotely and suspends the process to keep the program running
猜你喜欢

Record the problem that Navicat connection PostgreSQL cannot display the corresponding table

【MySQL】数据库函数通关教程上篇(聚合、数学、字符串、日期、控制流函数)

scikit-learn中的Scaler

FPGA - 7 Series FPGA selectio -05- logic of logic resources

5254. 卖木头块 动态规划

【利用MSF工具内网复现MS08-067】

Pyshark tutorial

【你所熟悉的网络真的安全吗?】万字文

C语言程序设计——三子棋(学期小作业)

Construction and protection of small-scale network examination
随机推荐
Are you sure about this filter?
【JDBC從入門到實戰】JDBC基礎通關教程(全面總結上篇)
Pycharm的快捷键Button 4 Click是什么?
Asp. Net web API 2 Lesson 18 - working with entity relations in OData
Pychart sets the default interpreter for the project
c技能树评测
Functions and methods in Scala
Niuke-top101-bm26
【笔记自用】myeclipse连接MySQL数据库详细步骤
DDD Practice Manual (4. aggregate aggregate)
Does intelligence need a body
Unity隐藏目录和隐藏文件
Issue 6: which mainstream programming language should college students choose
Delphi10 FTP file name garbled
827. 最大人工岛 并查集
粽子大战 —— 猜猜谁能赢
Mysql database foundation: sub query
FPGA - 7 Series FPGA selectio -02- introduction to source language
出现ConcurrentModificationException这个异常报错,怎么处理?
Mysql database foundation: connection query