首页 > Web开发 > 详细

jQuery-表单选择器

时间:2020-05-21 20:44:00      阅读:71      评论:0      收藏:0      [点我收藏+]

1.表单概念

:text        找所有的type="text"的input标签
:radio       type="radio"的单选按钮
:checkbox    type="cheakbox"的多选按钮
:checked     被选中的

2.代码展示

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>表单选择器</title>
</head>

<body>
    <input type="radio" name="sex" value="1" />男
    <input type="radio" name="sex" value="2" />女
    <button id="btn">提交</button>
</body>
<srcipt src=" https://cdn.bootcss.com/jquery/3.5.0/jquery.min.js"></srcipt>
<script>
    $("#btn").click(function() {
        console.log($(":radio:checked").val())
    })
</script>

</html>

jQuery-表单选择器

原文:https://www.cnblogs.com/dongxuelove/p/12933301.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!