Home >Web Front-end >JS Tutorial >JQuery drop-down box application example introduction_jquery

JQuery drop-down box application example introduction_jquery

WBOY
WBOYOriginal
2016-05-16 16:51:34897browse

To implement data movement between two drop-down boxes, add

Copy code The code is as follows:

$(' #add').click(function(){
var $options = $('#select1 option:selected'); //Get the selected item
var $remove = $options.remove();
$remove.appenTo('#select2');
});

Simplified as follows
Copy code The code is as follows:

$('#add').click(function(){
var $options = $('#select1 option:selected'); //Get the selected item
$remove.appenTo('#select2');
});
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn