jquery match elements with style font-size in px

前端 未结 2 962
臣服心动
臣服心动 2021-01-26 13:29

How to target element with inline-style font-size defined in pixels (ex: font-size:12px) in order to modify font-size on a button click.

Can someone help finish this jav

2条回答
  •  走了就别回头了
    2021-01-26 13:41

    You may try indexOf on style attribute:

    $('.parent').each(function (index, value) {
        if (/font-size:[^;]+px/.test($(this).attr('style'))) {
            alert(index + ": " + $(this).attr('style'));
        }
    });
    

    Here is Demo Fiddle

提交回复
热议问题