const onGridReady = (params) => {
setTimeout(() => {
const inputs = document.querySelectorAll('.ag-floating-filter-input input[type="text"]');
inputs.forEach((input) => {
if (!input.placeholder || input.placeholder === '') {
input.placeholder = 'Contains';
}
});
}, 300);
};
I want to add default placeholder text to AG Grid's floating filter input fields. I've developed the following code that sets a "Contains" placeholder for all empty text input fields after the grid loads.
A setTimeout is used because AG Grid needs a moment to fully render its DOM. This code should be added to the onGridReady event.