Inside Buttons
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
{
type: "input",
inputType: "text",
label: "Location",
model: "address.geo",
buttons: [
{
classes: "btn-location",
label: "Current location",
onclick: function(model) {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(pos) {
model.address.geo = {
lat: pos.coords.latitude.toFixed(5),
lng: pos.coords.longitude.toFixed(5)
};
});
} else {
alert("Geolocation is not supported by this browser.");
}
}
},
{
classes: "btn-clear",
label: "Clear",
type: "reset"
onclick: function(model, field) {
model.address.geo = {
lat: 0,
lng: 0
};
}
}
]
}