JQuery案例:左右选

左右选

<head>
	<meta charset="UTF-8">
	<title></title>
	<style>
		select {
			width: 100px;
		}
	</style>
	<script src="js/jquery-3.3.1.min.js"></script>
	<script>
		$(function() {
			$("[value='>>']").click(function() {
				var selected = $("#sel_left option:selected");
				$("#sel_right").append(selected);
			})
		});
	</script>
</head>

<body>
	<select id="sel_left" multiple="multiple">
		<option>A</option>
		<option>B</option>
		<option>C</option>
		<option>D</option>
		<option>E</option>
	</select>
	<input type="button" value=">>" />
	<input type="button" value="<<" />
	<select id="sel_right" multiple="multiple">

	</select>
</body>
posted @ 2019-07-12 22:30  虎老狮  阅读(210)  评论(0编辑  收藏  举报