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(){
                $("#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(){ $("#in").attr('value','大家好'); } </script> </head> <body> <input type="text" value="你好" id="in"/> <input type="button" value="设置属性" onclick="get()"> </body> </html>
提交重置代码
章节评论笔记课件
  • 取消回复发送
  • 取消发布笔记发送