AnsweredAssumed Answered

Adding jQuery Datepicker to Marketo Form?

Question asked by feeba007f57053a169fc063bd83dae05ffcbd0a3 on Jan 17, 2017
Latest reply on Feb 8, 2017 by sanford.whiteman

Has anyone had success loading the jQuery Datepicker into a Marketo form field?


Because the form dynamically populates, the Datepicker script doesn't work. I want to use this script so I can set the selectable calendar dates 72 hours in the future. Unless that capability is available in Marketo somewhere.


My script:


<link rel="stylesheet" href="//">

<script src="//"></script>

<script src="//"></script>


And then within my form call...


<script>MktoForms2.loadForm("", "APPID", FORMID,


    $( function() {

    $( "#Lead_Source_Notes__c" ).datepicker({ minDate: -20, maxDate: "+1M +10D" });

  } );

.... rest of form code


I want the datepicker to apply to the Lead Source Notes field and it doesn't. Also tried it without the $( function() { in front of the datepicker form call and nada either.



It DOES work on a text field outside of the Marketo form if I do this:



  $( function() {

    $( "#Lead_Source_Notes__c" ).datepicker({ minDate: +3, maxDate: "+1M" });

  } );



<p>Date: <input type="text" id="Lead_Source_Notes__c"></p>



So it's because Marketo is loading the form dynamically.


Any help?