Given an HTML document and the task is to select an element by its className using AngularJS.
Approach: The approach is to use the document.querySelector() method to get the element of a particular className. In the first example the element of className class1 is selected and its background color is changed to green. In the second example, 2 elements of same class are selected and some of the CSS is changed.
- How to select an element by name with jQuery?
- HTML | DOM Select name Property
- HTML | <select> name Attribute
- AngularJS | Select Boxes
- How to select first object in object in AngularJS?
- Why does AngularJS include an empty option in select ?
- How to find the parent class name with known class in jQuery ?
- How to select all elements without a given class using jQuery ?
- How to select a div with a certain class using jQuery ?
- How to exclude particular class name from CSS selector ?
- AngularJS | ng-class Directive
- AngularJS | ng-class-odd Directive
- AngularJS | ng-class-even Directive
- How to Set navbar active class with Bootstrap and AngularJS ?
- How to toggle class using AngularJS ?
- How to select all children of an element except the last child using CSS?
- How to set the default value for an HTML <select> element?
- How to remove options from select element using jQuery ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.