jQuery动态绑定事件(左右移动)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
div, div button {
display: inline-block;
float: left;
}
#button {
margin: 10px 10px;
}
</style>
</head>
<body>
<div>
<select name="" id="eg1" multiple>
<option value="">nihao1</option>
<option value="">nihao2</option>
<option value="">nihao3</option>
<option value="">nihao4</option>
</select>
</div>
<div id="button">
<button id="select_all" type="button"> ></button>
<br>
<button id="cancel_all" type="button"> <</button>
</div>
<div>
<select id="eg2" multiple>
<option value="">hah1</option>
<option value="">hah2</option>
</select>
</div>
<script src="jquery-3.3.1.js"></script>
<script>
// 选中全部
$('#select_all').click(function () {
$('#eg2').append($('#eg1>option'));
});
// 取消全部
$('#cancel_all').click(function () {
$('#eg1').append($('#eg2>option'));
});
// 双击选中
$('#eg1').on('dblclick', 'option', function () {
$('#eg2').append($(this));
});
// 双击取消
$('#eg2').on('dblclick', 'option', function () {
$('#eg1').append($(this));
});
</script>
</body>
</html>
jQuery动态绑定事件(左右移动)的更多相关文章
- jquery - 动态绑定事件
举个例子: html页面 <div><button type="button" class="test">测试</button&g ...
- jquery动态绑定事件
什么是动态绑定? 动态绑定是指动态添加的DOM节点或者html元素,他们最开始时运行的时候是不存在的.如果要给这些动态加入的节点增加事件,就必须要用jquery的on方法来绑定事件. $('.cont ...
- $("#XXX").click()和$("#YYY").on("click","指定的元素",function(){});的区别(jQuery动态绑定事件)
//绑定 下一页 的点击事件 $("a[aria-label='Next']").click(function(){ $("a[aria-label='Previous' ...
- Jquery中$("").事件()和$("").on("事件","指定的元素",function(){});的区别(jQuery动态绑定事件)
这个是在学习时不懂的问题,记录下来方便查看 转至https://www.cnblogs.com/mr-wuxiansheng/p/7136864.html //绑定 下一页 的点击事件 $(" ...
- jquery json遍历和动态绑定事件
<div id='tmpselectorList' style='border: 1px solid grey;max-height: 150px;position:absolute;text- ...
- jQuery的动态绑定事件的应用
注意:bind()的事件绑定是只对当前页面选中的元素有效.如果你想对动态创建的元素bind()事件,是没有办法达到效果的 <script src="jquery-1.11.2.min. ...
- [转]使用 jQuery Mobile 与 HTML5 开发 Web App —— jQuery Mobile 事件详解
在前文<使用 jQuery Mobile 与 HTML5 开发 Web App —— jQuery Mobile 默认配置与事件基础>中,Kayo 对 jQuery Mobile 事件的基 ...
- jquery 动态绑定bind()及模拟鼠标点击A链接
近来自觉前端有小小进步,幸而记之. 1.两个 css class 紧挨在一起 则在html元素中,要同时拥有这两个class,才能起作用 .block.db{ background-image:url ...
- jQuery的事件绑定与触发 - 学习笔记
jQuery的事件绑定与触发 事件绑定 自动触发事件 常用的鼠标事件 事件冒泡和默认行为 事件冒泡 默认行为 获得当前鼠标的位置和按键 jQuery的事件绑定与触发 事件绑定 基本绑定 $(eleme ...
随机推荐
- android中的内部存储与外部存储
我们先来考虑这样一个问题: 打开手机设置,选择应用管理,选择任意一个App,然后你会看到两个按钮,一个是清除缓存,另一个是清除数据,那么当我们点击清除缓存的时候清除的是哪里的数据?当我们点击清除数据的 ...
- poj 1679 The Unique MST (判定最小生成树是否唯一)
题目链接:http://poj.org/problem?id=1679 The Unique MST Time Limit: 1000MS Memory Limit: 10000K Total S ...
- Opencv2.4.13与Visual Studio2013环境搭建配置教程
转载:http://www.jb51.net/article/108943.htm 一.安装包的下载与安装 Opencv可免费到官网上去下载,opencv是国外软件,在下载是由于受资源的限制,可能会出 ...
- 深度解析pos机,养卡人必看!
好多人对POS 好像都比较迷茫,这个说这个POS 好,那个说那个POS 好.下面就我对POS 的认知给兄弟们说下.对与不对的各位见谅. 第一.一清机 一清机是指在结算日结算后直接通过支付公司账号转 ...
- C++ Notes 1 - size_type - Accelerated Ch3
1. 为什么用string::size_type而不是int? --Why use string::size_type ? int is supposed to work! it holds numb ...
- LeetCode-Maximal Rectangle[code]
code: #include <iostream> #include <vector> #include <stack> #include <algorith ...
- 沉淀,再出发:Git的再次思考
沉淀,再出发:Git的再次思考 一.前言 使用git也有很久了,后来有一段时间一直没有机会去使用,现在想来总结一下自己学习了这么长时间的一些心得感悟,我写的博客一般都是开了一个轮廓和框架,等到以后有所 ...
- 贴现力 (force of discount)
一.定义 用贴现函数a-1(t) 代替累积函数,在 t 时刻的贴现力为 增加一个负号使得贴现力为正. 二.重要的公式
- Oracle 12C pluggable database自启动
实验环境创建了两个PDB,本实验实现在开启数据库时,实现pluggable database PDB2自启动: 原始环境: SQL> shu immediateDatabase closed.D ...
- jclass和jobject的迷惑
[译]jclass和jobject 2012-09-18 15:02:58| 分类: Android |字号 订阅 jclass和jobject的迷惑第一次使用JNI,实例引用(jobject) ...