Update Coordinates and Zoom on Map Field
This JavaScript snippet lets you programmatically set the latitude, longitude, and zoom level of a JetFormBuilder map field on a specific form.
Specifications
Update Coordinates and Zoom on Map Field
5 January, 2026
-
Plugin
-
Category
-
Programming languages
Installing Instruction
- Copy the provided JavaScript code snippet to your clipboard.
- Add the code using one of the following methods:
-
Option A: Using a Custom Code Plugin (Recommended)
- Install and activate a plugin such as WPCode Lite, Code Snippets, or Simple Custom CSS and JS.
- Create a new JavaScript snippet.
- Paste only the JavaScript code, without <script> tags.
- Save and activate the snippet.
-
Option B: Using a Custom Code / HTML Area
- Add the code in a Custom HTML widget or directly into a theme file (for example, header.php or footer.php).
- Keep the <script> tags when using this method.
- Save your changes.
-
Option A: Using a Custom Code Plugin (Recommended)
Example Use Case
Use this snippet to dynamically set the position and zoom level of JetFormBuilder map fields programmatically. This is perfect for pre-filling maps based on user location, preferences, or other dynamic conditions.
Applicable scenarios:
- Travel and tourism sites — pre-set locations based on user selections or defaults.
- Real estate listings — show pre-defined map views for properties.
- Event booking sites — initialize map fields with event locations or areas.
Specifications
Update Coordinates and Zoom on Map Field
5 January, 2026
-
Plugin
-
Category
-
Programming languages