I have a Contact Form 7 on a wordpress site, which has a field with id coordinates
. In my javascript I have a variable event.latLng
, the value of which I want to write to this field. So I add the following:
jQuery(document).ready(function($) {$('#coordinates').val('event.latLng');});
However, the field now only displays ‘event.latLng’ instead of the value.
Any thoughts on how to change this?
Take it out of the single quotes, you’re sending in a string with the value ‘event.latLng’ instead of referring to the property latLng of the event object.
Try this (
'event.latLng'
should beevent.latLng
):