سؤال

I use the file upload plugin from Blueimp. In template download, I want to write value into

<div id="status"></div>

each time when template is render.

The div tag is put outside the form tag.
This is a script template download:

<script id="template-download" type="text/x-tmpl">
    {% 
        var location = document.getElementById("hdnLocation").value;
        var folder = document.getElementById("hdnFolder").value;
    %}

    {% for (var i=0, file; file=o.files[i]; i++) { %}    
        <div class="template-download fade clear-fix" data-value="{%=location%}\{%=folder%}\{%=file.name%}">
        ... do something ...
        {%
            document.getElementById("status").value = "TPL";
        %}
    </div>
    {% } %}

</script>

location and folder, I can get value but trying to set value is failed.

هل كانت مفيدة؟

المحلول

Your problem is here:

document.getElementById("status").value = "TPL";

You need to use innerHTML not value

document.getElementById("status").innerHTML = "TPL";

.value is a property assigned to input elements like input, select, textarea

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top