0
<fieldset class="fieldset">
    <legend>Curriculum vitae</legend>
    <div style="margin-bottom: 1em;">
        <div class="file-well" onclick="alertFilename()">
            <input type="file" name="file" id="file" onchange="fileSelect(event)" />
            <span id="filewelllabel">click here or drag and drop<br/></span>
            <span id="filewelllabel">one file only (.pdf, .doc, .docx, .docm)</span>
        </div>
    </div>

that's my drag and drop area (also clickable to manually select).

below that I got

<b id = "selected_file_file" class="span3" style="font-weight: bold; cursor: pointer; "> NAME HERE </b>

I need to update NAME HERE to selected input file name just after it is selected. I tried some queries from:

How to get file name when user select a file via <input type="file" />?

and some other using onChange function but it didnt work for me. Nothing happened.

How can I change displayed name after file is selected?

@edit

 <%-- drag and drop kolorowanie --%>

    $(function () {
        $('.file-well input').on('change', function (e) {
            console.log('change!');
            $(e.target).parent().removeClass('hover');
            $(e.target).parent().addClass('filled');

        });
        $('.file-well input').on('dragover', function (e) {
            console.log('dragover');
            $(e.target).parent().addClass('hover');
        });
        $('.file-well input').on('dragleave', function (e) {
            console.log('dragleave');
            $(e.target).parent().removeClass('hover');
        });
    });
    <%-- /drag and drop kolorowanie --%>

any1?

3
  • 1
    Do u Know An ID should be unique within a page Commented May 25, 2015 at 13:46
  • What is your JavaScript code? Commented May 25, 2015 at 13:47
  • alertFilename() at this moment is empty Commented May 25, 2015 at 13:55

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.