jQuery获得属性信息值 登录

jQuery获得属性信息值

jQuery获得属性信息值

$().attr(属性名称);    //获得属性信息值

<!DOCTYPE html>
<html>
    <head>
        <title>php.cn</title>
        <meta charset="utf-8" />
        <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>
        <script>
            function get(){
                alert($("#in").attr('value'));
            }
        </script>
    </head>
    <body>
        <input type="text" value="你好" id="in"/>
        <input type="button" value="获取属性" onclick="get()">
    </body>
</html>


下一节
<!DOCTYPE html> <html> <head> <title>php.cn</title> <meta charset="utf-8" /> <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script> <script> function get(){ alert($("#in").attr('value')); } </script> </head> <body> <input type="text" value="你好" id="in"/> <input type="button" value="获取属性" onclick="get()"> </body> </html>
提交 重置代码
章节 评论 笔记 课件
  • 取消 回复 发送
  • 取消 发布笔记 发送