JQuery autocomplete获得焦点触发弹出下拉框
需求:autocomplete控件,当点击获得焦点的时候也要弹出下拉列表(autocomplete默认是输入之后才会跟随出下拉列表),下面直接贴代码。
js代码:
$("#customerName").autocomplete({
minLength: 0,
source: function (request, response) {
var customerName = $("#customerName").val();
$.ajax({
url: "/api/pmstransaction/getcustomerinfo",
dataType: "json",
data: {
customerName: customerName
},
success: function (data) {
response(data.Data);
}
});
},
focus: function (event, ui) {
$("#customerName").val(ui.item.CustomerName);
return false;
},
select: function (event, ui) {
module.viewModel.customerInfo.CustomerName(ui.item.CustomerName);
module.viewModel.customerInfo.CustomerTaxCode(ui.item.CustomerTaxCode);
module.viewModel.customerInfo.CustomerAddressPhone(ui.item.CustomerAddressPhone);
module.viewModel.customerInfo.CustomerBankAccount(ui.item.CustomerBankAccount);
return false;
}
}).focus(function () {
$(this).autocomplete("search");
}).autocomplete("instance")._renderItem = function (ul, item) {
return $("<li>")
.append("<div>" + item.CustomerName + "</div>")
.appendTo(ul);
}
重点代码
focus(function () {
$(this).autocomplete("search");
})
JQuery autocomplete获得焦点触发弹出下拉框的更多相关文章
- easyui combobox点击输入框弹出下拉框
由于easyui combobox需要点击下拉箭头才能下拉,不能像select标签那样点击输入框就下拉,所以觉得不太方便,查看了一下,combobox弹出框是一个div,原本想在他的输入框的点击事件中 ...
- asp.net html 单击按钮弹出下拉框效果
1.说明 需要引用jquery.js文件,我的页面是在asp.net MVC4 添加的web窗体,其他不多说 直接看代码 2.代码 <%@ Page Language="C#" ...
- ActionBar点击弹出下拉框操作
首先: getActionBar().setDisplayShowTitleEnabled(false); ActionBar.LayoutParams lp = new ActionBar.Layo ...
- CSS实现鼠标移入弹出下拉框
前言 最近比较沉迷CSS,所以我现在来做个鼠标的交互效果 HTML <ul> <li>测试</li> <li>测试</li> <li ...
- IOS第二天-新浪微博 - 添加搜索框,弹出下拉菜单 ,代理的使用 ,HWTabBar.h(自定义TabBar)
********HWDiscoverViewController.m(发现) - (void)viewDidLoad { [super viewDidLoad]; // 创建搜索框对象 HWSearc ...
- jQuery制作简洁的多级联动Select下拉框
今天我们要来分享一款很实用的jQuery插件,它是一个基于jQuery多级联动的省市地区Select下拉框,并且值得一提的是,这款联动下拉框是经过自定义美化过的,外观比浏览器自带的要漂亮许多.另外,这 ...
- JQuery和ASP.NET分别实现级联下拉框效果
在学习JQuery之前知道下拉框的级联效果可以通过asp.net控件实现,现在学习了JQuery,知道了JQuery和select也能实现.我分别举两个小例子说明这两种方法如何实现. 1.用JQuer ...
- 用css写出下拉框(代码转自wq群)
做网易云音乐首页时遇到的问题,鼠标指在右上角头像时出现下拉框. <style>/* css*/ #body{ float: left; } #xialakuang{ background- ...
- jquery的clone()引发的问题,下拉框点击没有反应
此段代码是对某块元素的移位:上移.下移.对比修改前后的两段代码: 修改前: //点击移位 function move(obj,posi){ var al=$(obj).parent('li').par ...
随机推荐
- Python基础之面向对象2(封装)
一.封装定义: 二.作用 三.私有成员: 1.基本概念及作用 2.__slots__手段私有成员: 3.@property属性手段私有成员: 四.基础示例代码 1.用方法封装变量 "&quo ...
- TCSL:遇到网络正常,但是添加网口打印机总是失效的问题。
1. 环境 这家店要换成TCSL餐饮系统,但是店主希望在换系统时候,保持原来系统正常运转.所以,一开始踩点和实施都是小心翼翼~~ 不过,还是遇到问题,没法打印,如果开启TCSL打印服务,就会和原来的餐 ...
- [Swift]LeetCode242. 有效的字母异位词 | Valid Anagram
Given two strings s and t , write a function to determine if t is an anagram of s. Example 1: Input: ...
- [Swift]LeetCode268. 缺失数字 | Missing Number
Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missin ...
- [Swift]LeetCode413. 等差数列划分 | Arithmetic Slices
A sequence of number is called arithmetic if it consists of at least three elements and if the diffe ...
- [Swift]LeetCode989. 数组形式的整数加法 | Add to Array-Form of Integer
For a non-negative integer X, the array-form of X is an array of its digits in left to right order. ...
- Truncated incorrect DOUBLE value: 'd'的解决方法(jdbc)
今天写jdbc中dao的增删改查时遇到了一个问题,花费了好长时间,不过还好,有我峰哥出头,问题解决了,在这做个分享,对峰哥表达一下感激之情 网上搜索到的对“Truncated incorrect DO ...
- 小程序自定义pick(日期加时间组合)
最近小程序有个需求要使用日期加时间的pick组件 翻了小程序文档似乎没有符合的 手写一个 新建组件picker.js: Component({ properties: { disabled: { t ...
- hive中beeline取回数据的完整流程
这里我们从BeeLine.execute讲起. 接下来来到BeeLine.dispatch,这里的入参就是sql语句.方法的最后调用了Commands.sql,然后调用到了Commands.execu ...
- restful风格的API
在说restful风格的API之前,我们要先了解什么是rest.什么是restful.最后才是restful风格的API! PS(REST:是一组架构约束条件和原则,REST是Roy Thomes F ...