Home > Web Front-end > JS Tutorial > Jquery changes the selected status of radio/checkbox and gets the selected value (sample code)_jquery

Jquery changes the selected status of radio/checkbox and gets the selected value (sample code)_jquery

WBOY
Release: 2016-05-16 17:09:38
Original
1108 people have browsed it

//If it has been selected before, cancel the selected radio
$("#tj_cat .pro_category").each(function()
{
if ($(this).attr('checked ')){
                                                                                                                                                                            $(this). Same as this)
var val=$('input:radio[name="sex"]:checked').val();
//The following writing method can also be used
//var val= $('.sexclass:checked').val();
select:
var sel_val=$("select[id='shuini'] option:selected").val();
/ /The following writing method can also be used
//var sel_val=$('.must_write option:selected').val();
//var sel_val=$('#shuini option:selected').val( );
//var sel_val=$("select[name='shuini1'] option:selected").val();

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template