0

I have html document with button 'Add new' and hidden div (style='display: none;') with additional fields. When user click on button 'Add new' div become visible:

<script>
$(document).ready(function () {
    $('#add_new').click(function () {
            $('#add_new_panel').show();
            $(this).hide();
        });

    $('#selected_file').change(function(){
            alert(44);
        });
});
</script>

<div id="add_new_panel" style="display: none;">
    <input type="file" id="selected_file" name="testFile" />
</div>

The problem is when I choose file in input field jQuery change event on this field never fires. If I remove style='display: none;' from add_new_panel div it works correctly. But I need hide this div until user doesnt click on button. How can I do this? Maybe I can bind change event handler with another code?

P.S. On the other page this works perfectly with 'display: none;'.

Sorry for my bad english. Thanks.

Dmitriy
  • 654
  • 10
  • 24

1 Answers1

0

The problem was in name of input file field. I remove name attribute and now it works. 2 hours was spent for nothing. Excuse me :).

Dmitriy
  • 654
  • 10
  • 24