BootWiki教程网
源代码:
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>BootWiki 教程网</title> <script src="//cdn.staticfile.net/jquery/1.10.2/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $("p").removeAttr("id class"); }); }); </script> <style type="text/css"> #p1{ color:white; background-color:green; font-size:20px; padding:5px; } .blue{ color:white; background-color:blue; font-size:20px; padding:5px; } </style> </head> <body> <h1>这是一个标题</h1> <p id="p1">这是一个段落。</p> <p class="blue">这是另一个段落。</p> <button>移除所有P元素的id和类属性</button> </body> </html>
运行结果