0

Using Angular.js how can I change text color in a text box upon entering data to it?

user3836920
  • 151
  • 1
  • 1
  • 6
  • There are about a million ways, be more specific and show your code – alou Aug 11 '14 at 10:57
  • In this link my code is there http://jsfiddle.net/eTTZj/920/ In that when we enter the data at that time the text color sholud be red .pls provide suggestion – user3836920 Aug 11 '14 at 10:58
  • Try something like this http://jsfiddle.net/t4hwspms/ – alou Aug 11 '14 at 11:11
  • look Mark Rajcok's answer in this thread http://stackoverflow.com/questions/13813254/how-do-i-conditionally-apply-css-styles-in-angularjs – Victor Aug 11 '14 at 11:13

1 Answers1

-1

I Haven't used Angular yet but if anyone else could benefit from this..

using javascript

<!DOCTYPE html>
<html>
<head>
    <style>
        #box{ width:180px; height:20px; border: solid 1px #333; }
        p{text-align: center}
    </style>

    <script>
        document.onreadystatechange = function()
        {
            if(document.readyState == "complete")
            {
                var change = document.getElementById("change");
                var box = document.getElementById("box");

                change.onclick = function()
                {
                    box.style.color = "#33f";
                }
            }
        }
    </script>
</head>
<body>
    <span id="box" contenteditable="true">This is My Text</span>
    <button id="change">changeme</button>
</body>
</html>
Itachi Sama
  • 886
  • 1
  • 6
  • 18