jquery移除属性值

旧城等待, 2023-06-12 06:20 135阅读 0赞
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <title></title>
  5. <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
  6. <style type="text/css">
  7. </style>
  8. <script type="text/javascript" src="jquery-1.7.1.min.js"></script>
  9. <script type="text/javascript"> window.onload=function(){ $('#btnOk').click(function(){ //移除属性值(把font元素下的color属性移除)
  10. $('font').removeAttr('color'); }); }; </script>
  11. </head>
  12. <body>
  13. <font color='#336699'>字体10</font>
  14. <hr />
  15. <font>字体2</font>
  16. <hr />
  17. <input type="button" id='btnOk' value='确定' />
  18. </body>
  19. </html>

更多专业前端知识,请上 【猿2048】www.mk2048.com

发表评论

表情:
评论列表 (有 0 条评论,135人围观)

还没有评论,来说两句吧...

相关阅读