Can someone please help me with how to change the font color of the Search element’s text input field? By default, it appears to be dark gray, which is very difficult to read against my website’s black background.
By specifying type=“search” it wont mess with any placeholder text you may have in other non-search input elements.
If you decide you want another search element that doesn’t share the same color placeholder text you can add the class name to CSS to specify the specific element.
Hey, I thought I would also drop this here for anyone as I was struggling for a while to figure this out.
If you want to change the placeholder text of an input field there is a native way inside Webflow.
as seen here in the style selector panel
However, if you need to change the input text as in the text that the user inputs into the search box you would have to use custom JS.
Here is my setup for a simple email form with two inputs:
<script>
document.addEventListener('DOMContentLoaded', function() {
let input1 = document.getElementById('email-input');
let input2 = document.getElementById('name-input');
// Add an event listener for the input event on input1
input1.addEventListener('input', function() {
// Change the color of the user-inputted text for input1
input1.style.color = '#51504c'; // Change this to the desired text color
});
// Add an event listener for the input event on input2
input2.addEventListener('input', function() {
// Change the color of the user-inputted text for input2
input2.style.color = '#51504c'; // Change this to the desired text color
});
});
</script>
You have to select the ID given to the input field and change the colour of the text by injecting CSS.