在CSS或jQuery中为动态类设置值 [英] Set value for dynamic class in CSS or jQuery

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

问题描述

我有Facebook的评论模块安装在WordPress,由于某些未知的原因Facebook做了一些改变,现在我需要改变的类是动态的,例如#feedback_7324324h #feedback_kjwyhr #feedback_234734dsfn 等等,唯一相等的部分是 #feedback _ 是否有任何方式或机会将任何元素的 #feedback _ 设置为100%?

I have Facebook Comment module installed in WordPress, for some unknown reason Facebook made some changes and now the class I need to change is dynamically as for example #feedback_7324324h, #feedback_kjwyhr, #feedback_234734dsfn and so on, the only equal part is #feedback_ is there any way or chance to set width to 100% on any element that holds #feedback_ as class?

推荐答案

您可以使用属性启动使用选择器(类开头的哈希看起来很奇怪?)

You can use the attribute starts with selector (the hash at the beginning of the class seems strange ?)

jQuery('[id^="feedback_"]').css('width', '100%' );

这篇关于在CSS或jQuery中为动态类设置值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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