Home >
Web Front-end >
JS Tutorial >
jQuery implements automatic display and hiding of forms according to type_jquery
jQuery implements automatic display and hiding of forms according to type_jquery
WBOY
Release: 2016-05-16 16:08:39
Original
1333 people have browsed it
jquery implements form animation switching based on radio buttons. I wrote it yesterday. I feel it has made a lot of progress compared to the js/jquery I wrote when I first started learning. . It is possible to streamline the code while maximizing scalability.
//Automatically show and hide forms based on type
var input_type=$('input[name=type]');
function typeChangeHandle(){
var ctypes=$('.ctype');
var type=$(this).val();
var hideCtypes=ctypes.filter(':not(.ctype' type ')').slideUp(500,function () {
$('.ctype' type).slideDown(500);
});
}
typeChangeHandle.apply(input_type);
input_type.on('change',typeChangeHandle);
input_type=null;
The above is the entire content of this article, I hope you all like it.
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