AI工具推荐 视频效率加速

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>
提交重置代码
  • 评论
  • 课件下载

面对疾风吧

结合上一章的看更好。。

9年前      0

我喜欢晴天

上一个是获取,这一个获取之后,改变value的值

9年前      0

末日的春天

设置和获取是属性一样的。。。

9年前      0

课件暂不提供下载,工作人员正在整理中,后期请多关注该课程~