jQuery删除属性

jQuery删除属性

$().removeAttr(属性名称);  //删除属性

<!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").removeAttr('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").removeAttr('value'); } </script> </head> <body> <input type="text" value="你好" id="in"/> <input type="button" value="删除属性" onclick="get()"> </body> </html>
提交重置代码