jquery if then语句为css值 [英] Jquery if then statement for css value

查看:197
本文介绍了jquery if then语句为css值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想检查一个具有css class =x的div是否具有height =auto。如果是的话,我想(使用jquery脚本)css-class =a从所有元素中删除css-class =y。如果不是脚本不必做任何事情。感谢

I want to check whether a div with a css class="x" has height="auto". If yes I want (with a jquery script) the css-class="a" removed from all elements with the css-class="y". If not the script does not have to do anything. thanks

推荐答案

if ($('div.x').css('height') === 'auto') {
    $('.y').removeClass('a');
}

这篇关于jquery if then语句为css值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆