bootstrap modal box open jquery location picker

Pink Code

I work With jquery location picker plugin for google map. now, I open map into bootstrap 3.0 modal box. This worked, But I need to: when click in save changes button show longitude and latitude in result input box.

JS:

$('#us2').locationpicker({
    location: {
        latitude: 46.15242437752303,
        longitude: 2.7470703125
    },
    radius: 300,
    inputBinding: {
        latitudeInput: $('#us2-lat'),
        longitudeInput: $('#us2-lon'),
        radiusInput: $('#us2-radius'),
        locationNameInput: $('#us2-address')
    }
});

$(document).ready(function () {

    $("#btnModal").click(function () {
        //How Can I Copy myDiv here so that I can also view it in Modal
        $("#myModal").modal('show');
        $("#myDiv").appendTo(".modal-body");
    });

    $('#myModal').on('hide.bs.modal', function (e) {
        $("#myDiv").prependTo("body");

    })
});

HTML :

<a data-toggle="modal" href="#myModal" class="btn btn-primary">Launch modal</a>

<div class="modal" id="myModal">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                 <h4 class="modal-title">Modal title</h4>

            </div>
            <div class="modal-body">Location:
                <input type="text" id="us2-address" style="width: 200px" />Radius:
                <input type="text" id="us2-radius" />
                <div id="us2" style="width: 500px; height: 400px;"></div>Lat.:
                <input type="text" id="us2-lat" />Long.:
                <input type="text" id="us2-lon" />
            </div>
            <div class="modal-footer"> <a href="#" data-dismiss="modal" class="btn">Close</a>
 <a href="#" class="btn btn-primary">Save changes</a>

            </div>
        </div>
    </div>
</div>
result lat: <input type="text" id="lat" />
result long: <input type="text" id="lon" />

I have result long and result lat for input/join value form modal box when click in save changes button. How to create This ?

DEMO : http://jsfiddle.net/hagR2/

davidkonrad

Give the "save changes" btn an id :

<a href="#" class="btn btn-primary" id="save-changes">Save changes</a>

add a click handler to the btn that transfers the values to the main page and closes the modal :

$("#save-changes").click(function() {
   $("#lat").val($('#us2-lat').val());
   $("#lon").val($('#us2-lon').val());        
   $('#myModal').modal('hide');
})

forked fiddle -> http://jsfiddle.net/Lzv7w/

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Open a youtube video in bootstrap modal box

From Java

How to open a Bootstrap modal window using jQuery?

From Dev

how to open a modal (bootstrap) using jQuery?

From Dev

Why does this jQuery color picker fail within a Bootstrap modal?

From Dev

Why does this jQuery color picker fail within a Bootstrap modal?

From Dev

How can I open bootstrap modal on select box option change?

From Dev

How to open a bootstrap modal box after submitting a form by barcode scanner

From Dev

Jquery + Bootstrap Modal, open a modal inside the other... why?

From Dev

Two Modal box in Bootstrap

From Dev

Bootstrap: Open Another Modal in Modal

From Dev

How to open a bootstrap modal when checked a chec-box (when a tick is placed on a check box)

From Dev

Bootstrap Modal open on condition

From Dev

Bootstrap Modal open on condition

From Dev

Open and close bootstrap modal

From Dev

Jquery to open Bootstrap v3 modal of remote url

From Dev

How to use hash value to open a bootstrap modal using jquery?

From Dev

How to get the ID of the last open bootstrap modal dialog in jQuery?

From Dev

jquery generate modal box

From Dev

How to open mat date picker in a modal?

From Dev

Using <img> in Bootstrap Modal Box

From Dev

time-picker in bootstrap modal dialog

From Dev

time-picker in bootstrap modal dialog

From Dev

Bootstrap datetime picker in Modal mode not appearing

From Dev

Open modal window with Jquery

From Dev

Bootstrap 3 Modal: how to check if modal is open or closed using jquery/javascript

From Dev

Bootstrap 3 - open modal from another modal

From Dev

Bootstrap Modal - same modal multiple open dialogs

From Dev

confirm modal jquery bootstrap

From Dev

JQuery Datepicker in Bootstrap modal

Related Related

HotTag

Archive