I have an HTML input, as well as some buttons.
 <input type="number" placeholder="" id="id"/>
 <button onclick="myfunction()" >Click Me</button>
 <button onclick="toggle()">toggle</button>
The first button has this JavaScript function
var myfunction=function(){
    if(bool){
        a=document.getElementById('id');
        a.placeholder='Invalid Character';
    }
};
bool=false;
and the second button's function is this:
toggle=function(){
    bool=!bool;
};
Basically, click the second button to change whether
bool
is true or false. The first button will set a placeholder if the value of bool is true. I want to figure out how to DYNAMICALLY set the color of a placeholder with JavaScript. I have found how to do it with CSS, but I need JavaScript. No jQuery or other frameworks please.
Thanks!
Travis J I specifically said that this is not a duplicate, as I CANNOT use CSS, like the question you mistakenly marked this as a duplicate of
I can ONLY use javscript, not css.
 
    