0
私はタイプファイルの入力フィールドを動的に生成しています。しかし、私はトリガイベントを取得しようとすると何も起こりません。オン( '変更')トリガーなし
は、以下の動的な入力ファイル
<div id="documentlist" class="col-lg-12">
<div class="input-group">
<div class="fileinput fileinput-exists" data-provides="fileinput">
<span class="btn btn-primary btn-file m-r-10 waves-effect">
<span class="fileinput-new">Upload Your </span>
<span class="fileinput-exists">Document</span>
<input type="hidden" value="" name="">
<input id="0" class="selectdocument" type="file" name="..." multiple>
</span>
<span id="form_f" class="fileinput-filename"></span>
<a href="#" class="close fileinput-exists" data-dismiss="fileinput">×</a>
</div>
</div>
</div>
私のイベントハンドラselect
要素とinput
要素のためのinput
ため
// Select Document Form
$('#documentlist').on('change', '.selectdocument', function() {
alert(this.id);
});
水平スクロールバーは避けてください。 – reporter
変更を親要素にではなく入力にバインドする必要があります。 –
また、id = "0"を使用しているとトラブルが発生しています。ドキュメント内のすべてのIDが一意でなければならないため、より具体的なものを使用してください。 Zakaria Acharkiその複製ではありません。 – SpliFF