On WordPress is use Ninja Forms. i have a page with multiple Date Fields in the same Form ( date of arrival and date of departure). I need to change the Value of both Date fields.
the following example script works (i can add jQuery to the page by a WP plugin), but is changing the value of both fields:
<script>
$( document ).ready( function() {
new(Marionette.Object.extend( {
initialize: function() {
this.listenTo( Backbone.Radio.channel( 'pikaday' ), 'init', this.modifyDatepicker );
},
modifyDatepicker: function( dateObject, fieldModel ) {
dateObject.pikaday.setDate( '04/11/2016' );
}
}));
});
</script>
i don't know how to address the 2 fields separately. The 2 fields created by Ninja Forms look like this (they differ only by the ID):
<div class="nf-field-element">
<div class="pikaday__container"><input id="nf-field-66" name="nf-field-66" class="ninja-forms-field nf-element datepicker" value="11/04/2016" type="hidden">
<input class="pikaday__display pikaday__display--pikaday ninja-forms-field nf-element datepicker" placeholder="" type="text">
</div></div>
Any idea how to adjust the jQuery?