HTML date input with a disabled date picker

I am using a simple date input field

<input type="date" id="sign-up-dob" class="sign-inputs" max="2999-12-31"></input>

Here is what it looks like:

https://i.sstatic.net/fdM0r.png

Is there a way to remove the arrows and calendar icon on the right side of the input field so that users can only manually enter the date? I would appreciate any help, thank you.

Answer №1

One way to enforce a specific date format in a text input is by using the pattern attribute:

input:invalid {
    color: red;
}

[type="date"]::-webkit-inner-spin-button {
  display: none;
}
[type="date"]::-webkit-calendar-picker-indicator {
  display: none;
}
<label>Input Date (YYYY-MM-DD):
<input type="text" pattern="[0-9]{4}-[0-9]{2}-[0-9]{2}" />
</label>

<input type="date" />

Answer №2

Click here for reference

webshim.setOptions('forms-ext', {
    replaceUI: 'auto',
    types: 'date',
    date: {
        startView: 2,
        inlinePicker: true,
        classes: 'hide-inputbtns'
    }
});
webshim.setOptions('forms', {
    lazyCustomMessages: true
});
//start polyfilling
webshim.polyfill('forms forms-ext');

//only last example using format display
$(function () {
    $('.format-date').each(function () {
        var $display = $('.date-display', this);
        $(this).on('change', function (e) {
            //webshim.format will automatically format date to according to webshim.activeLang or the browsers locale
            var localizedDate = webshim.format.date($.prop(e.target, 'value'));
            $display.html(localizedDate);
        });
    });
});
.hide-replaced.ws-inputreplace {
    display: none !important;
}
.input-picker .picker-list td > button.othermonth {
    color: #888888;
    background: #fff;
}
.ws-inline-picker.ws-size-2, .ws-inline-picker.ws-size-4 {
    width: 49.6154em;
}
.ws-size-4 .ws-index-0, .ws-size-4 .ws-index-1 {
    border-bottom: 0.07692em solid #eee;
    padding-bottom: 1em;
    margin-bottom: 0.5em;
}
.picker-list.ws-index-2, .picker-list.ws-index-3 {
    margin-top: 3.5em;
}
div.ws-invalid input {
    border-color: #c88;
}
.ws-invalid label {
    color: #933;
}
div.ws-success input {
    border-color: #8c8;
}
form {
    margin: 10px auto;
    width: 700px;
    min-width: 49.6154em;
    border: 1px solid #000;
    padding: 10px;
}
.form-row {
    padding: 5px 10px;
    margin: 5px 0;
}
label {
    display: block;
    margin: 3px 0;
}
.form-row input {
    width: 220px;
    padding: 3px 1px;
    border: 1px solid #ccc;
    box-shadow: none;
}
.form-row input[type="checkbox"] {
    width: 15px;
}
.date-display {
    display: inline-block;
    min-width: 200px;
    padding: 5px;
    border: 1px solid #ccc;
    min-height: 1em;
}
.show-inputbtns .input-buttons {
    display: inline-block;
}
<form action="#" class="ws-validate">
     <h2>1 Calendars without visible input</h2>

    <div class="form-row">
        <input type="date" class="hide-replaced" />
    </div>
    <div class="form-row">
        <input type="submit" />
    </div>
</form>
<hr />

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

IntelliSense in VS Code is unable to recognize CSS files

I'm currently in the process of creating a React application, however, I've encountered an issue where importing a .css file doesn't prompt vscode to display the file in the intellisense feature. https://i.sstatic.net/nxhyV.png It's u ...

Arranging squares in a circular formation with Three.js

I am facing an issue with aligning squares within a circular grid to its center. Despite the correct center point, the entire grid is consistently skewed to the right. The problem could be due to incorrect calculations for removing squares outside the cir ...

Is it possible to create custom animations in react.js using just JavaScript and CSS?

Curious to know if it's achievable in React.js to create animations from the ground up solely using JavaScript and CSS. If so, could anyone guide me to relevant documentation or provide some insight? Much appreciated. ...

Hello there! Could you please provide some guidance on how to insert a photo onto a website using Django?

How can I implement a feature that allows users to choose a photo for a product from within the system or enter a URL to use as the image? The selected image should be displayed in the product list along with other relevant information. I have written the ...

What is causing the navigation bar items to shift with the logo when attempting to position it to the left?

Whenever I attempt to shift .logo to the left, it also drags all the other navbar items (Home, Features, Pricing, Disabled) along with it. All I want is for .logo to move to the left without affecting the positioning of the other navbar items. I should me ...

HTML5 sortable lists, ajax posting, and inactive elements are not functioning correctly

I'm currently utilizing a fantastic plugin for jQuery known as HTML5 Sortable. It can be found at . I am attempting to disable certain items using this plugin. My approach involves adding the class="disabled" to the <li> tag and including items ...

What strategies can I use to enhance the efficiency of my code using AngularJS?

After conducting extensive research, I am still unable to find a solution or comprehend the code written by someone else - it simply does not work. As a result, my codebase has grown significantly. I am interested in optimizing my code using AngularJS func ...

Concern regarding the width of select forms in Internet Explorer

When coding a select dropdown box using simple HTML, I encountered an issue where it displayed properly in Google Chrome and Firefox, but not in Internet Explorer. In IE, the dropdown became too long and extended out of the box. I attempted to set the wid ...

Inject a <div> element into a table row upon clicking a button using jQuery and PHP

I am faced with an issue regarding displaying pdf reports within specific table rows. The scenario involves a table containing folder paths and buttons in each row. Upon clicking the button, the path is sent to a sequence of PHP files (ajax.php, ajax2.php, ...

ng-show directive in AngularJS is not functioning properly when utilized with CLI

After setting up my Angular app with ng new app, I attempted to hide certain elements conditionally using ng-show. Unfortunately, it doesn't seem to be working as expected. <span ng-show="false">Angular App</span> Regardless ...

avoid inserting into a specific field with a specific name

I am trying to add a picture next to a specific name, but I am facing issues as there is no option for inserting it. This is how my table looks: https://i.sstatic.net/RRaTb.png How can I insert a picture in front of a particular name? The content of my ...

Creating a responsive CSS background image

I am using an image as a background for a class on the left side with a white background. The width of the class is 1368px and the image size is 392px by 600px. I want to fix this image on the left side of the class, making it responsive. Even though I hav ...

Difficulty in aligning elements to the edges of the screen

How can I adjust the positioning of these two arrow indicators to be aligned with the left and right edges of the screen, regardless of size? .arrow-container { position: absolute; top: 37%; width: 95%; display: grid; grid-template-columns: 10 ...

The CSS3 slideshow is displaying distorted and unfocused images

I have a CSS code that controls the timing of my slideshow with 3 images: .slideshow li:child(1) span { background-image: url(../../pic/bg1.jpg); } .slideshow li:child(2) span { background-image: url(../../pic/bg2.jpg); -webkit-animation-de ...

Leveraging Bootstrap 5 to Ensure Consistent Image Heights in Carousels

Currently, I am developing a carousel using Bootstrap 5 and I want all images to have a consistent size regardless of their original dimensions. Here is the current state of the carousel: https://i.sstatic.net/TFVdy.png My goal is for the next image in ...

Is there a way to align my text to the right of an image?

My current code is displaying an image https://i.sstatic.net/Nmnr6.jpg I want it to show a different image instead: https://i.sstatic.net/MH7sR.jpg This is the HTML code I'm using: </div> <div class= "Row1"> <h2>Looking ...

Angular UI-Router: Customizable template for dynamic content

My goal is to dynamically load a navbar based on the user, but I am facing difficulties accessing my $rootScope. $stateProvider /*Login*/ .state('login', { url: '/', data: {pageTitle: 'Sign in.'}, ...

manipulating an iframe on a separate domain

Currently, I am in the process of creating a mobile app using the Ionic framework for my website. Nevertheless, I believe that the issue at hand is not exclusive to Ionic. My goal within the app is to showcase a full-width, full-height iframe loading a sp ...

Select the card if the input spinner value is greater than zero

Hello, I am currently working on a front-end tool for quoting purposes. The user will need to click on a card and select which product they would like to add to their basket. There is also an input section available for the user to specify the quantity usi ...