Set value for dynamic class in CSS or jQuery

2019-09-17 09:43发布

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?

2条回答
时光不老,我们不散
2楼-- · 2019-09-17 10:46

Yeah like this

$("[class^='#feedback_']")

Docs --> https://api.jquery.com/attribute-starts-with-selector/

查看更多
ら.Afraid
3楼-- · 2019-09-17 10:47

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

jQuery('[id^="feedback_"]').css('width', '100%' );
查看更多
登录 后发表回答