"Step-by-step guide to show a calendar in a popup window

I am having trouble with displaying the calendar on a popup. I have created the popup and want to show the calendar within it. I've tried implementing the code but the calendar is not showing up. Any assistance would be greatly appreciated. Please check the URL - you'll find the Popup option, click on that to display the popup.


   <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8>
    <title>Sirius Sport</title>



    <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"/>
    <script src="//code.jquery.com/jquery-1.10.2.js"></script>
    <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>



    <style>
    #popupBoxThreePosition{
        top: 0; left: 0; position: fixed; width: 100%; height: 120%;
        background-color: rgba(0,0,0,0.7); display: none;
      }
      .popupBoxWrapper{
        width: 70%;height: 100%; margin: 50px auto; text-align: left;
      }
      .popupBoxContent{
        background-color: #FFF; padding: 15px;
      }
    </style>


</head>
<body>

<!--Section2-->
<section>
    <div id="content_1" class="content">


<div class="col-md-6">
<div class="post2">

  <div class="box">


      <div id="wrapper">

      <p><a href="javascript:void(0)" onclick="toggle_visibility('popupBoxThreePosition');"><h4>Popup</h4></a> </p>

    </div>
    </div>
  </div>
  </div>

    </div>
</section>
<!--End Section2-->



<!-- Popup content -->
<div id="popupBoxThreePosition">
      <div class="popupBoxWrapper">
        <div class="popupBoxContent">
            <div class="row">
                <div class="col-xs-6 col-md-4">

      </div>

</div>

  <div id="datepicker"></div><!-- calender-->


          <p><a href="javascript:void(0)" onclick="toggle_visibility('popupBoxThreePosition');"><h5>Close</h5></a></p>

        </div>
      </div>
    </div>

  <!--End Popup-->







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


<script src="js/popup.js"></script>

<script src="js/bootstrap.min.js"></script>

<script src="js/viewportchecker.js"></script>

<script type="text/javascript">

jQuery(document).ready(function() {
  jQuery('.post').addClass("hidden1").viewportChecker({
      classToAdd: 'visible animated slideInLeft', // Class to add to the elements when they are visible
      offset: 100    
     });   
});     

jQuery(document).ready(function() {
  jQuery('.post2').addClass("hidden1").viewportChecker({
      classToAdd: 'visible animated slideInRight', // Class to add to the elements when they are visible
      offset: 100    
     });   
});     


function toggle_visibility(id) {
             var e = document.getElementById(id);
             if(e.style.display == 'block')
                e.style.display = 'none';
             else
                e.style.display = 'block';
          }



    $( "#datepicker" ).datepicker();


</script>
</body>
</html>

Answer №1

Here is a helpful code snippet for you to use:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8>
    <title>Sport</title>

<link href='http://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="css/animate.css" />
<link rel="stylesheet" type="text/css" href="css/demo.css" />
<link rel="stylesheet" href="css/style.css" media="screen" />
<link href="css/bootstrap.min.css" rel="stylesheet" />
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" />


    <style>
    #popupBoxThreePosition{
        top: 0; left: 0; position: fixed; width: 100%; height: 120%;
        background-color: rgba(0,0,0,0.7); display: none;
      }
      .popupBoxWrapper{
        width: 70%;height: 100%; margin: 50px auto; text-align: left;
      }
      .popupBoxContent{
        background-color: #FFF; padding: 15px;
      }
    </style>

</head>
<body>

<!--Section2-->
<section>
    <div id="content_1" class="content">

  <h2> Sport</h2>
      <p>Subheading Subheading Subheading</p>

      <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>

<div class="col-md-6">
<div class="post">
  <div class="box " >

      <img src="Images/section1.jpg" alt="" style="height:300px;width:400px; ">
      <h4>Learn to sail Camps & Events at H20</h4>
      <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. <br>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s</p>

<div id="wrapper">

      <p>
        <a href="javascript:void(0)" onclick="toggle_visibility('popupBoxThreePosition');">
          <h4>Popup</h4>
        </a> 
      </p>

    </div>

    </div>  </div>
  </div>

<div class="col-md-6">
<div class="post2">

  <div class="box">
      <img src="Images/section2.jpg" alt="" style="height:300px;width:400px;">
      <h4> My First Sailing Experience</h4>
      <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. <br>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s</p>

      <div id="wrapper">

      <p><a href="javascript:void(0)" onclick="toggle_visibility('popupBoxThreePosition');"><h4>Popup</h4></a> </p>

    </div>
    </div>
  </div>
  </div>

    </div>
</section>
<!--End Section2-->



<!-- Popup content -->
<div id="popupBoxThreePosition">
      <div class="popupBoxWrapper">
        <div class="popupBoxContent">
            <div class="row">
                <div class="col-xs-6 col-md-4">
                  <h3>MURUD JANJIRA</h3>
                 <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. <br>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.Lorem Ipsum is simply dummy text of the printing and typesetting industry. </br>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.Lorem Ipsum is simply dummy text of the printing and typesetting industry. </br>Lorem Ipsum has been the industry's standard dummy text </p>
                </div>

            </div>

           <input class="datepicker" data-date-format="mm/dd/yyyy" />


            <p><a href="javascript:void(0)" onclick="toggle_visibility('popupBoxThreePosition');"><h5>Close</h5></a></p>

    </div>
  </div>
</div>

  <!--End Popup-->







<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>


<script src="js/popup.js"></script>

<script src="js/bootstrap.min.js"></script>

<script src="js/viewportchecker.js"></script>

<script type="text/javascript">

 $('.datepicker').datepicker({
    format: 'mm/dd/yyyy',
    startDate: '-3d'
})

jQuery(document).ready(function() {
  jQuery('.post').addClass("hidden1").viewportChecker({
      classToAdd: 'visible animated slideInLeft', // Class to add to the elements when they are visible
      offset: 100    
     });   
});     

jQuery(document).ready(function() {
  jQuery('.post2').addClass("hidden1").viewportChecker({
      classToAdd: 'visible animated slideInRight', // Class to add to the elements when they are visible
      offset: 100    
     });   
});     


function toggle_visibility(id) {
   var e = document.getElementById(id);
   if(e.style.display == 'block')
      e.style.display = 'none';
   else
      e.style.display = 'block';
}



</script>
</body>
</html>

The issue may be related to loading jquery first instead of getting the correct one. Applying this solution should resolve your problem.

Answer №2

Concerns:

Your webpage contains too many duplicate scripts:

<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js">
</script>

You have duplicated 2 versions of the jQuery UI library. Additionally, there are more scripts and libraries referenced at the bottom of the page.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js">
</script>
<script src="js/popup.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/viewportchecker.js"></script>

Furthermore, another reference of the jQuery library is included at the bottom.

<script>
    $( "#datepicker" ).datepicker();
</script>

The datepicker code should be enclosed within a document ready block to ensure proper DOM manipulation.

If not wrapped properly, the script may execute before the necessary DOM elements are loaded, causing issues.

This excessive use of different library versions can lead to conflicts.

Solution:

It is advisable to stick to one version of jQuery for consistency. Consider using these scripts:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js">
</script><!-- Include this before jQuery UI-->
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js">
</script><!-- Place this after jQuery lib but before using UI widgets-->
<script src="js/popup.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/viewportchecker.js"></script>
<script>
    $(document).ready(function(){ // Enclose in doc ready block
        $( "#datepicker" ).datepicker(); // Datepicker initializer here
        jQuery('.post').addClass("hidden1").viewportChecker({
             classToAdd: 'visible animated slideInLeft', // CSS class when visible
              offset: 100    
         });   

         jQuery('.post2').addClass("hidden1").viewportChecker({
             classToAdd: 'visible animated slideInRight', // Class when visible
             offset: 100    
         });   
    });     


     function toggle_visibility(id) {
         var e = document.getElementById(id);
         if(e.style.display == 'block')
            e.style.display = 'none';
         else
            e.style.display = 'block';
      }
</script>

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

Cross-Origin Resource Sharing - redirecting to the page that is being retrieved by a subsequent GET request

My web page makes AJAX requests using JQuery $.ajax to load content. However, if the user session expires, re-authentication is required. When a user is not authenticated, two GET requests are sent to the website: one with the requested URL in the AJAX (o ...

Incorporating lodash into Angularjs for enhanced functionality

After stumbling upon an app online that utilizes AngularJS with Lodash, I noticed a simple way in which Lodash is incorporated. By including the following line in the body (after angular has been included): <script src='vendor/lodash/3.3.1/lodash. ...

What is the best way to implement a sidebar closing animation?

Utilizing both react and tailwindcss, I successfully crafted a sidebar menu that elegantly appears from left to right when the user clicks on the hamburger icon. However, my attempts to create a reverse animation as the sidebar disappears from right to lef ...

How come I am experiencing difficulty modifying the background color of ion-header using a CSS class selector within my Ionic Vue component?

Recently, I began my journey with ionic vue and started incorporating CSS with the components. I added styles in the same file like this: <style scoped> .abc { background-color: blue; } </style> I attempted to apply these style ...

Leveraging functions with Ng-Repeat

I am currently dealing with two different arrays of objects. The first array contains a list of permissions groups, while the second array consists of user groups. My main goal is to compare the Group Owner (which is represented by ID 70) with the list of ...

What is causing the "mb-3" class from Tailwindcss to malfunction with next/link?

The "mb-3" class from Tailwindcss in this Next.js component seems to have no effect in the Y direction. However, when using the "m-3" class, it also doesn't affect the Y direction, but instead has an impact on the X direction. impo ...

Is there a way for me to retrieve the specific comment ID that I am looking to respond to?

I have written the code below and I am looking to extract a specific ID to reply to a comment. Can someone please review the snippet below and provide guidance on the necessary steps to achieve this. .anc { cursor: pointer; } <script src="https://c ...

Creating regex to detect the presence of Donorbox EmbedForm in a web page

I am working on creating a Regex rule to validate if a value matches a Donorbox Embed Form. This validation is important to confirm that the user input codes are indeed from Donorbox. Here is an example of a Donorbox EmbedForm: <script src="https: ...

Adjust dimensions of an image retrieved from a URL

Is there a way to adjust the size of the image displayed here?: var picture = new Image(); picture.src = 'http://www.example.com/images/logo.png'; picture.width = 200; //trying to change the width of the image $('canvas').css({ ...

How can mouse clicks be detected using jQuery?

I am looking to dynamically add a class to a link as soon as the user clicks on it, rather than waiting for the mouse click event to be released. Additionally, I want this added class to be removed once the user releases the mouse click. My goal is to repl ...

Adding a new div using Jquery after a specific table row

I am having trouble displaying additional data in a table when a specific row is clicked. Here is the table structure I am working with: <div id="display"> <div class="displayRow"> <img src="images/expand-arrow.gif" class="expandArrow ...

Unable to interpret the JSON reply from the server

I am currently developing a web application that sends data to a website, which then updates its database and returns a JSON array to replace my web app page. I am using AJAX for this query, but I am facing an issue with preventing the overwriting of my we ...

Encountering an error message of "Cannot POST" while trying to send data through a REST client application

Upon my attempt to add a new entry into the Doctors database I created, I encountered an error that has left me perplexed. This is how my server.js file appears: const express = require('express'); const bodyParser = require('body-parser&a ...

Struggling with CSS to display images

Struggling to align my images within the designated red lines in the CSS sections I created. Can't seem to get it right. Here's my HTML: <!-- Your code goes here --> <div class="container"> <section class="left"> <h1& ...

The JSON response is returning an undefined value

While working on my react app, I am logging JSON data from the backend of the application. When I log the main body of the data: console.log('........section2', options2ndSection[2]); The returned JSON data is as follows: Object item: ...

End the rendering process in Three.js

When loading a large obj file on computers that do not support WebGL, the process can become too slow. To address this issue, I am looking to upload a lighter object before and after the complete object loads. However, I need a way to pause the rendering p ...

When I apply properties in JavaScript, I find that I am unable to utilize the CSS "hover" feature

For a personal project I am currently working on, I decided to experiment with setting background colors using Javascript. However, I have encountered an issue where my CSS code that changes the hover property does not seem to work after implementing the J ...

Having difficulty completing the text field and submitting it automatically

My goal is to automatically fill in the "Reason for Access" text box with the word "TEST" using Tampermonkey. I am new to using Tampermonkey and UserScript, so I appreciate your patience. Currently, I am facing an issue where the "Reason for Access" field ...

The JavaScript alert box cannot retrieve data from the PHP parent page

What am I missing? Here is the JavaScript code snippet: <script language="javascript"> function openPopup(url) { window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no, menubar=no,scrollbars=n ...

The art of toggling input values with Angular JS

I have a simple application where users input string values into two fields and the text is incorporated into a sentence. I am looking to add a button that, when clicked, will switch the values in the fields. HTML <body> <div ng-app="myApp" ng ...