My research in the basic HTML DOM element says this in any property of the "style" property of the DOM element (from http://www.w3schools.com/jsref/dom_obj_all.asp ):
"style
The tag is a dom element. And thus, he possesses the property of "style." As he points to the w3schools link above, all dom elements have a style property.
And in fact, here I install (build) style for the label property of the label - and it works fine:
<label for="itemImageId" style="color: gray" id="labelForImageUploadID">Item image</label>
The label text color is gray when the page loads.
Under a certain condition (the user indicated that they are ready to select an image to upload) - I need to show the download as “on” by changing the original gray text above to black.
Do I know that I could use the css class for this label text color and use the className property to dynamically change the css class above? You are betting. Tonight, though I keep this DOM element to fire. I just have one attribute “style” for changing (text color) and I don’t want to add a class just for it - what I'm trying here should work in accordance with the documents.
I want to know why I cannot use the style property, because the DOM says that I can "get" and "set" the DOM element of the property.
"" - "style" - - :
document.getElementById('labelForImageUploadID').style = "color: rgb(0,0,0)";
:
document.getElementById('labelForImageUploadID').style = "color: black";
( javascript) , , onclick , .
"" "" DOM?
http://www.w3schools.com/jsref/dom_obj_all.asp,
"HTMLElement Object
The following properties, and methods can be used on all HTML elements."
(other properties here.....)
"style
(still other properties here......)
, "style", ?