我有时看到有这样的东西:
<input name="star2" type="radio" class="star 1"/>
<input name="star2" type="radio" class="star 2"/>
在 jQuery 中是否可以让一个类来处理这两个类?因为基本上他们有同一个父类,哪个是star?如果可能的话,我该怎么做?使用正则表达式?
最佳答案
是的,您可以使用 $('.star')
选择它们。您可能一直在尝试引用的是 starts with attribute selector .
另外,我怀疑 1
是一个有效的类名。
关于javascript - DOM 和 jQUery 的类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5769334/