Can I apply a CSS style to an element name?

后端 未结 10 1367
借酒劲吻你
借酒劲吻你 2020-12-07 14:39

I\'m currently working on a project where I have no control over the HTML that I am applying CSS styles to. And the HTML is not very well labelled, in the sense that there a

10条回答
  •  再見小時候
    2020-12-07 15:03

    This is the perfect job for the query selector...

    var Set1=document.querySelectorAll('input[type=button]');  // by type
    
    var Set2=document.querySelectorAll('input[name=goButton]'); // by name
    
    var Set3=document.querySelectorAll('input[value=Go]'); // by value
    

    You can then loop through these collections to operate on elements found.

提交回复
热议问题