在jQuery中删除或更改CSS伪类 [英] Removing or altering CSS pseudo class in jQuery

查看:1307
本文介绍了在jQuery中删除或更改CSS伪类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个很简单的问题,所以简短-无论如何,是否有可能使用jQuery删除或更改CSS伪类?或其他任何与此相关的Javascript方法

特别是我想摆脱:专注于输入.我无法以任何方式直接更改CSS文件.

感谢您的帮助

Buster

解决方案

我不能直接在CSS文件中更改 任何方式.

假设您只能 使用JavaScript来做到这一点,我想不到的任何东西都比:

$('head').append('<style>input:focus{background:#fff}</style>');

您将必须分别重置每个属性. font-weight:normalcolor:#000-随您所需.

请参见: http://jsfiddle.net/jqpAu/

A simple enough question, so briefly - is it possible to remove or alter in anyway a CSS pseudo class using jQuery? Or any other Javascript method for that matter

Specifically I want to get rid of :focus on inputs. I can't alter the CSS file directly in any way.

thanks for any help

Buster

解决方案

I can't alter the CSS file directly in any way.

Assuming you can only use JavaScript to do this, I can't think of anything better than:

$('head').append('<style>input:focus{background:#fff}</style>');

You will have to individually reset each property. font-weight:normal, color:#000 - whatever you need.

See: http://jsfiddle.net/jqpAu/

这篇关于在jQuery中删除或更改CSS伪类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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