PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, October 27, 2022

[FIXED] how to set datetime picker in prestashop

 October 27, 2022     jquery, jquery-ui, php, prestashop, prestashop-1.7     No comments   

Issue

I'm developing prestashop module.now i'm trying to add datetime picker to my .tpl file

i tried below code.but it's date picker.

<div id="mymodule_block_home" class="block">

<input class="datetimepicker" type="text" >

<script type="text/javascript">
    $(document).ready(function(){
                                $(".datetimepicker").datepicker({
                                prevText: '',
                                nextText: '',
                                dateFormat: 'yy-mm-dd'
                            });
                            });

</script>
</div>

I tried it with $(".datetimepicker").datetimepicker.then my console showing Uncaught TypeError: $(...).datetimepicker is not a function


Solution

This happens when you haven't imported the jQueryUI into your current page.

TypeError: $(...).datepicker is not a function

You can reproduce the issue on this JSBin by deleting the jQueryUI script tag fram the head section: http://jsbin.com/feqarocebo/1/edit?html,console,output

First you have to check your page header. If there isn't listed the jQueryUI than you have to add it from the current controller

The accepted way is to do this:

public function setMedia() {
    $this->addJqueryUI('ui.datepicker');
}

If this won't solve the issue then pls also check the project folder for the jQuery UI components/ .js files.

(or manually by editing the header.tpl).

<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>


Answered By - Gabo3D
Answer Checked By - Robin (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing