jQuery: pass value to field Contact Form 7

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.

Read More

Any thoughts on how to change this?

Related posts

Leave a Reply

2 comments

  1. 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.