I want to block the ‘Date’ field from clicks because I add the default date on the field and I don’t want the customer to change it, I don’t want to use the hidden field option because it will be hidden first and second I want to inform the customer about that date without change the ’ Date Field’ is there a way I could do that with CSS code to do it?
there are several ways you can make a date field(or any other) not clickable by the user. Personally I don’t recommend it since it’s a bad user experience, but you can add
form input[type="date"],
form input#date_of_birth-input{
pointer-events:none;
}
at the bottom of your main CSS file if you want it to affect every date field in every form on your page. If you want to have it on one particular page you can add it like this
<style>
form input[type="date"],
form input#date_of_birth-input{
pointer-events:none;
}
</style>
to the “header-HTML” section in the advanced options of in settings tab of the particular page
Note: replace “date_of_birth-input” with the name of your property. If you’re unsure inspect the element in the browser by right-click and “inspect element”. The ID is the information you’re looking for
hope this helps
best,
Anton
Moderator note: While this solution may not address the original poster’s specific situation, it could be helpful for other community members facing similar challenges.
Hi, Anton, Thank you so much for this valuable information, but what If I’m using WordPress with Elementor Page Builder, What is the best way to do that?
Thank you for the CSS, but when I try it it doesn’t work, I don’t know why, I understand that CSS that you give it right, but I don’t know why is not working on the WordPress website, can you please help me?