Twitter Bootstrap の「アラート」機能を使用して、次のようにユーザー通知を表示しています。
<div class="notification alert alert-info">
<button type="button" class="close" data-dismiss="alert">×</button>
My message goes here
</div>
これらの通知は、ユーザーが閉じるまで持続するため、ユーザーが「閉じる」ボタンをクリックすると、通知を永久に閉じる必要があることを示す ajax クエリをサーバーに送信したいと考えています。
私はjQueryのon()
関数を次のように使用しています:
$(document).on('click', '.notification .close', function (e) {
alert('hi!');
console.log(e);
e.preventDefault();
});
これはうまくいきますが、これを行う「ブートストラップ」方法があるかどうか疑問に思っていますか?