Stanislas Piotrowski
Stanislas Piotrowski

Reputation: 2694

jquery calendar datepicker does not work with my include php

I met some trouble while using input type dates, also I decided for reasons of compatibility to change all input type date by type of text using class datepicker.

When I'm on index.php everything works fine.

When I'm on an other page for example index.php?p=home. Even if it displays the same page as index.php no calendar does appear.

Here is the code I use for changing the input.

<body onmousemove="resetTimer()" onload="startTimer();startTime();<?php if(isset($_GET['p']) AND $_GET['p']=='monitoring'){echo 'ajax();' ;}; ?>changefield()"> 
<!-- Script DATE  -->
<script>
    $(function() {
        $("input[type=date]").replaceWith("<input type='text' class='datepicker'/>");
        $( ".datepicker" ).datepicker({
            changeMonth: true,
            changeYear: true,
            showWeek: true,
            beforeShowDay: '',
            showAnim: "show"
        });
    });
</script>  

I really do not know how to find an issue to this problem.

Receive all my utmost Respect.

Kind Regards.

SP.

Upvotes: 0

Views: 678

Answers (2)

Vitalii Maslianok
Vitalii Maslianok

Reputation: 1631

Your code should work...

jsfiddle

maybe you don't include the jquery-ui script ?

Upvotes: 1

Andrew
Andrew

Reputation: 12809

You have a typo for starters:

A`ND $_GET['p']=='monitoring'

Upvotes: 0

Related Questions