星空网 > 软件开发 > Java

jquery属性选择器(匹配具有指定属性的元素)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html ="http://www.w3.org/1999/xhtml"> <head> <title>属性选择器</title> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> <style type="text/css"> .yang{ border-collapse: collapse; width:500px;height:30px;border:1px solid red;"} </style> <script type="text/javascript" src='/images/loading.gif' data-original="jquery-1.7.1.min.js"></script> <script type="text/javascript"> /*  [attribute] :匹配具有指定属性的元素  [attribute=value] :匹配属性为指定值的元素  [attribute!=value] :匹配属性值不等于指定值的元素  [attribute^=value] :匹配属性值以指定值开始的元素  [attribute$=value] :匹配属性值以指定值结束的元素  [attribute*=value] :匹配属性值中包含指定值的元素  [selector1][selector2][selectorN] :同时指定多个匹配条件 */    window.onload=function(){    $('#btnOk').click(function(){    //匹配具有color属性的font并把内容改为jquery      $('font[color]').html('jquery');      });    }; </script> </head> <body>  <font>字体1</font>  <hr />  <font color="#336699">字体2</font>  <hr />  <font color="#667788">字体3</font>  <hr />  <font color="#338899">字体4</font>  <hr />  <font color="#FFAA99">字体5</font>  <hr /> <hr/> <input type="button" id='btnOk' value='确定' /> </body></html>

 




原标题:jquery属性选择器(匹配具有指定属性的元素)

关键词:jquery

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流