且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

选择具有特定属性的元素

更新时间:2023-01-17 18:37:18

该值可以省略:

input[onclick]{color: red;}

无关紧要的是,这似乎是一个有趣的用例.我可能会使用类似这样的方法,可能是在边框上设置样式,或者是在文本上设置一些内容,以突出显示具有事件处理程序属性的表单元素(或任何其他元素),以进行调试".

On an unrelated note, this seems like an interesting use case. I would probably use something like this, perhaps styling the border or something instead of the text, in order to highlight form elements (or any other elements) with event handler attributes, for "debugging" purposes.