I’m attempting to pass the lat, long using HTML5 geolocation to automatically populate two form fields in a Django form using JavaScript. I’ve found a new solutions, but the form is a Meta class form where the html is automatically generated, and it doesn’t seem to be able to have a manner to add an “id” tag to it for this type of access.
Is there a proper way to access and populate fields in a Meta class form in this manner using JavaScript? Any insight appreciated.
When you get the location via HTML5 geolocation, you can use javascript to populate the fields. Look at the generated HTML code of the form & grab the ids of the fields. Here’s a sample jQuery code: