screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html lang="en"> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.min.js"></script> </head> <body> <div ng-app="myApp" ng-controller="myController" class="container"> <h3>Angular Js Get Element By Id</h3> <button ng-click="changeColor()">Change Color</button> <div id="element_id">Text with Color</div> </div> <script> angular.module("myApp", []).controller("myController", function ($scope) { $scope.changeColor = function () { var element = angular.element(document.querySelector("#element_id")); element.css("color", "red"); }; }); </script> <style> .container { max-width: 500px; margin: 0 auto; padding: 20px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); } .container h3 { font-size: 24px; margin-bottom: 20px; } </style> </body> </html>