0

I have this CSS: input::placeholder {font-size: 30px}

and I trying to change input placeholder CSS in JS

var inputPlaceholder = document.querySelector("input::placeholder");
inputPlaceholder.style.fontSize = "5px";

but console returns Uncaught TypeError: Cannot read property 'style' of null.

How to to change input placeholder CSS in the right way?

0

1 Answer 1

0

Try For This:

<input type="text" style="font-size: 30px" placeholder="Here." id="new"/>

var inputPlaceholder = document.getElementById('new');
inputPlaceholder.style.fontSize = "5px";
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.