I am currently working on a project for a company's website that utilizes placeholder attributes.
My main goal is to extract the color styling from this SPECIFIC ATTRIBUTE only, rather than from the input element itself.
The style is applied using --webkit-input-placeholder:
::-webkit-input-placeholder {
color: red;
}
However, my attempt to retrieve the value through JavaScript has yielded an incorrect result:
var color = window.getComputedStyle(document.querySelector('[class=abc]'),
'::-webkit-input-placeholder').getPropertyValue('color');
Instead of getting the expected color:
rgb (255, 0, 0)
I am receiving:
rgb (0, 0, 0)
For reference, I have created a fiddle showcasing this issue: https://jsfiddle.net/darnold24/6q1pr5cf/
If anyone could provide assistance, it would be greatly appreciated. Additionally, I do have access to jQuery, although based on my understanding, it may only retrieve properties of elements and not attributes.