I have a web app, backend using Django, frontend using HTML5.
I want to pass a variable from bootstrap table to the quotation in javascript.
<th class ='Format_issued' data-field="book.publisher" data-formatter="renderFormat">Material Format</th>
<script>
function renderFormat(value) {
return '<select style="width: 7em" name="Material_format" id="Material_format" >\n' +
' <option value="">--Select--</option>\n' +
' <option value="eText" {% if ' + value + ' == "eText" %} selected="selected" {% endif %}>eText</option>\n' +
' <option value="No Material" {% if value == "No Material" %} selected="selected" {% endif %}>No Material</option>\n' +
'
' </select>'
}
</script>
'value' is the variable that I want to pass.
But I have tried several method:
1 . use ' + value + ': ' <option value="eText" {% if ' + value + ' == "eText" %} selected="selected" {% endif %}>eText</option>\n'
2 . use value in my js quotation directly: ' <option value="No Material" {% if value == "No Material" %} selected="selected" {% endif %}>No Material</option>\n'
all could not pass the value variable.
How could I pass 'value'?