Support » Plugin: WP Datepicker » Missing JS concatenation operator causes error

  • Resolved thaikolja


    Hi Fahad,

    A client of mine uses your plugin. While running a backup with BackupBuddy, it reported a JS error:

    And in Chrome’s Developer Console:

    Looking at wpdp_auto_script.js, lines 52 and 53 are missing the + concatenation operator:

    if ($('input[data-original_id='datum']').val()!= "") {
    	$('input[data-original_id='datum']').attr('data-default-val', $('input[data-original_id='datum']').val());

    Apart from these three instances, there have been three more on lines 154 and 155.

    Changing it to the following got rid of the error:

    if ($('input[data-original_id=' + datum + ']').val()!= "") {
    	$('input[data-original_id='+ datum + ']').attr('data-default-val', $('input[data-original_id='+ datum + ']').val());

    You can find the full fixed content of wpdp_auto_script.js here.

    Also, consider minifying your JavaScript and only execute it on pages where it’s actually needed to prevent conflicts.

    • This topic was modified 2 months, 3 weeks ago by thaikolja.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support danialcooper


    @thaikolja thanks for pointing it out, we will resolve it in upcoming version. You can use Speed Optimization tab to define Allow Only pages.

    Plugin Author Fahad Mahmood


    Thank you @danialcooper

    @thaikolja please have a look on functions.php line no. 562

    You will notice that actually you tried to use a JS selector with single quotes. As I am already using single quotes there so conflict appeared.

    The file you found is not actually part of our plugin when you install it, on save changes you get this file according to your settings. As there were different scattered snippet of codes being rendered among files, we combined them as wpdp_auto_script.js and now you are expecting minification of this file. We will consider minification request in future. I am releasing another version with the fix regarding concatenation.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.