Display the datepicker beneath the input field

I successfully integrated the datepicker, but I prefer for the calendar to display below the date input field rather than above it.

HTML5

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <title>Jobportal - Login</title>

    <!-- Bootstrap -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
          integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>

    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
            integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
            crossorigin="anonymous"></script>

    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<form class="form-horizontal">
    <fieldset>

        <legend>Recruiter - Add Job</legend>

        <div class="form-group">
            <label class="col-md-4 control-label" for="txtjobtitle">Job Title</label>
            <div class="col-md-4">
                <input id="txtjobtitle" name="txtjobtitle" type="text" placeholder="" class="form-control input-md" required="">

            </div>
        </div>

        <div class="form-group">
            <label class="col-md-4 control-label" for="txtjobref">Job Reference</label>
            <div class="col-md-4">
                <input id="txtjobref" name="txtjobref" type="text" placeholder="" class="form-control input-md" required="">

            </div>
        </div>

         <div class="form-group">
            <label class="col-md-4 control-label" for="date">Closing Date</label>
            <div class="col-md-4">
                <input class="form-control" id="date" name="date" placeholder="MM/DD/YYY" type="text" required="">
            </div>
        </div>




    </fieldset>
</form>


<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.4.1/js/bootstrap-datepicker.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.4.1/css/bootstrap-datepicker3.css"/>

<script>
    $(document).ready(function(){
        var date_input=$('input[name="date"]');
        var container=$('.form-horizontal').length>0 ? $('.form-horizontal').parent() : "body";
        date_input.datepicker({
            format: 'mm/dd/yyyy',
            container: container,
            todayHighlight: true,
            autoclose: true,
        })
    })
</script>


<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
        integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
        crossorigin="anonymous"></script>
</body>
</html>

Answer №1

Here is a suggestion:

$(function () {
  $("#fiscalYear").datepicker({
    dateFormat: "mm/dd/yy",
    orientation: "top" // remember to include this for proper placement
  });
});

Visit Datepicker Orientation Documentation for more information.

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

What steps should I take to prevent my <mat-card> from expanding whenever messages are shown in Angular 9?

I have a <mat-card> containing a login form on my page. However, when error messages are displayed, the vertical size of the <mat-card> changes and I need it to remain the same. Is there a way to prevent this from happening? Below, you will ...

More content will not be displayed beneath folded DIVs arranged to stack on mobile devices

On my website, I have two separate sections dedicated to use cases and benefits. Here is the code: .onboardmessaging { min-width: 100%; } .onboardmessagingwrap { min-width: 100%; } .usecase { padding-left: 8vw; max-widt ...

What is the method for retrieving a specific value following the submission of an AngularJS form?

Here is how my form begins: <!-- form --> <form ng-submit="form.submit()" class="form-horizontal" role="form" style="margin-top: 15px;"> <div class="form-group"> <label for="inputUrl" class="col-sm- ...

Sending unstyled HTML content using JavaMail

Can anyone offer guidance on sending an email using JavaMail with unformatted HTML tags? Here is the code I am currently using: public void sendMail() throws MessagingException, IllegalStateException, IllegalArgumentException { Properties properties ...

Modifying Arrays with Different Data Structures in JavaScript

I am interested in implementing the following scenario: var A = ["Jon","Brad","Rachel"]; var B = ["Male","Male","Female"]; var C = [ {"Jon","Male"}, {"Brad","Male"}, {"Rachel","Female"} ] Can you guide me on how to retrieve var C using javascrip ...

I keep running into a problem that says "Uncaught TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))". I've been unable to come up with a solution so far

const Header = () => { const firebaseAuth = getAuth(app); const provider = new GoogleAuthProvider(); const [{user}, dispatch] = useStateValue(); const login = async () =>{ const { user: { refreshToken, providerData }, } = await sign ...

Tips for sending and receiving an ajax request using jQuery

I just started learning about jQuery and I'm finding it difficult to understand the documentation. I have a JavaScript variable (which I've already collected from an html form) that I need to send to the server using AJAX. After the server proces ...

Positioning a centered div with absolute positioning may result in offset issues on Android devices when the content exceeds the viewport size

Encountering a peculiar issue on Android browsers, particularly when the following elements are present on a page: A div element larger than the device's viewport size. (In this case, set at 1200px.) One or more other div elements styled for centeri ...

What is the process for sending the selected checkbox text to an action result on a Razor page?

Working with asp.net core razor pages, I am passing the selected id as an array successfully. However, the issue arises when the selected text value for the checkbox is not being passed or displayed. The problem seems to be occurring on this line of code ...

Display three images with titles in a row using CSS

I'm trying to align 3 figures with captions horizontally in the middle of the page, side by side, but so far I've only been able to do it vertically. How can I achieve this using just HTML5 and CSS? This is my current HTML: <div class="r ...

The jQuery Bootstrap Toggle is throwing an error: "Syntax error, unrecognized expression: #" within the Function.Sizzle.error

I am currently utilizing Jquery 3.3.1 and Bootstrap 3.3.7 that I fetched through npm. Below is the code snippet I have to toggle a div: <div class="text-right"> <a class="js-accordion-trigger" data-toggle="collapse" href="#advanced-search" ...

Dynamically scrolling an element using jQuery without specifying specific values

I need to keep an element fixed when scrolling on a page without setting specific height values. Do you know of any way to achieve this? Below is the code for reference: // Keep the orange box at the top after scrolling to a certain extent $(window).sc ...

The function $.get does not function correctly when added to Button.ClientSideEvents.Click during the second click

string okumagecmisiStr = string.Format("function(s,e){{ $.get('/GetHazirRapor.ashx?RaporTanimi={0}',function(data){{location.href='{1}'}} ); }}", hrt.ID, hrt.WebRaporLink); ButtonWebRaporAc.ClientSideEvents.Click = okumagecmisiStr; T ...

Modify the title attribute within a span tag in PHP using AJAX

I'm currently working with Zend Framework 2 and I have a requirement to translate a string in my index.html file, which displays a tool tip when hovering over a span tag. The challenge I face is that this value needs to change dynamically after perfor ...

Empty Ajax array sent to PHP

I am encountering an issue with my ajax form where the values in an array are coming out as null in my PHP response. I suspect that there may be a mistake in my .ajax call. Can anyone provide suggestions or insights on how to resolve this issue? My code sn ...

Developing a personalized data binding feature with AngularJS and utilizing ng-repeat

Looking to design a unique controller that can display multiple similar objects connected to a dataset structured like this: [{name: card1, values: {opt1: 9, opt2: 10}},{name: card1, values: {opt1: 9, opt2: 10}}] The goal is to showcase the name and one ...

Sending Ajax data to a controller function

I am looking for guidance on how to pass values from my view to my controller using ajax. As someone who is new to working with ajax, I would appreciate some assistance in understanding the process. Full Page @model ALSummary.Models.MonthReport @{ ...

Adjust the navigation height to be proportional to the main content size

I've been attempting to make my navigation menu take up the entire page, but I have yet to achieve success: My goal is for the green menu section to extend down to the footer. Here is the HTML code: <div ...

The Expressjs router prioritizes resolving before retrieving data from Firestore

UPDATE: Upon further investigation, I discovered that by adding "async" to the function signature, the output now displays in the intended order. However, I am still encountering an error regarding setting headers after they have already been sent, even th ...

The issue of the footer kicking out of place in the HTML layout was successfully resolved after

I am in the process of creating a simple footer that will always stay at the bottom of the page. The content on the page will not exceed the screen size, eliminating the need for scrolling. (There are a total of 5 HTML pages, and I want the footer and head ...