Tell me more ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Is it possible to render a template like jsRender to a div created with Leaflet's .create method as follows?

info.onAdd = function (map) {
    this._div = L.DomUtil.create('div', 'info');
    this.update();
    return this._div;
};

Using JsRender, a JavaScript template library and jQuery, I was able to create a template reading the selected feature properties. See following code.

function highlightFeature(e) {
    var layer = e.target;
    thisTown = e.target.feature.properties;
    $("#townList").html( // a <ul>
        $("#townTemplate").render(thisTown)
    );
...
}

I've tried countless variations to no avail.

share|improve this question
I may have to re-phrase my question. I'm so clueless I can't really explain what I need. You'd think since I figured out a template engine I 'd know how to render it ... – geomajor56 Jan 6 at 0:25

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.