初めてjQueryを使用してモーダルのボタンでデータを送信しようとしていますが、2回目をクリックすると2回、3回目は3回実行しますそのボタンを一度だけ実行するには、何が間違っていますか? 私のモーダルモーダル、多くの時間実行されるモーダルのボタン
`<div id="Modal" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content modal-sm">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">product</h4>
</div>
<div class="modal-body">
<label>Quantity</label>
<input type="text" class="form-control" id="qty" value="">
<label>Note:</label>
<input type="text" class="form-control" id="note" value="">
</div>
<div class="modal-footer">
<button id="" type="button" class="btn btn-primary mdismiss" data-dismiss="modal">Add</button>
</div>
</div>
</div>
</div>`
私のjQuery:
`
$('#btnbtn').click(function(){
$('#Modal').modal('show');
$('#addbutton').click(function(){
alert();
});
});`
「e.stopPorpagation()」 – guradio
私に完全なjsコードを教えてください。 –