Pete Pete - 11 months ago 42
jQuery Question

Missing values in Mustache template

I'm trying to render the body of a bootstrap modal using Mustache.js. The template contains a form with various input controls which have a value attribute set to a Mustache variable, e.g

<input id="VenueName" name="VenueName" class="form-control input-sm" type="text" required maxlength="100" data-error="Please enter a venue name (100 chars max)" value="{{VenueName}}">

The data is returned from an Ajax call and the template is in a separate file, I use $.get to get the file contents and process them..

At run time, the modal with the form is displayed but the input controls all have empty values.

After getting the template and the data, I execute the following commands:

var rendered = Mustache.render(template, venue);

I added an alert(rendered) between the above two lines and I can see that Mustache has correctly added the actual values to the template but they are not showing up when I set the html of the modal body.

Any ideas?

Answer Source

Turns out this wwas caused by some old js code left lying around. Sorry should have cloed this a few days ago.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download