jQuery - How to select all elements with a set font-family applied to them?

岁酱吖の 提交于 2019-11-30 21:17:54
jAndy

well, you can extend the jQuery selectors with

$(document).ready(function(){
   $.extend($.expr[':'], {
     AvantGardel: function(elem){
        var $e = $(elem);
        return( typeof $e.css('font-family') !== 'undefined' && $e.css('font-family') === 'AvantGardeITCbyBT-Bold' );
     },
     SansSerif: function(elem){
       var $e = $(elem);
        return( typeof $e.css('font-family') !== 'undefined' && $e.css('font-family') === 'sans-serif' );
     }
 });    
});

and then call

$(':AvantGardel').hide();

or

$(':SansSerif').hide();

for instance.

working example: http://jsbin.com/idova3/edit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!