I'd like to open a modal with bootstrap 3 data-toggle="ajaxmodal". The link is appended to a div, the ajaxModal however is not working.
$('<div/>').text(message.text).prepend($('<em/>').html('Opponent: '+ opponentName + ',' + ' ' + 'Game amount: ' + message.amount + ' ' + 'tokens,' + ' ' + 'Game: ' + message.game + ' ' + ' ' + ' ' + '<a href="console/challengeView.php?id=' + message.gameID + '" id="viewButton" class="btn btn-s-s btn-danger" onClick="return false;" data-toggle="ajaxModal">View</a>')).appendTo($('#pendingChallenges'));
$('#pendingChallenges')[0].scrollTop = $('#pendingChallenges')[0].scrollHeight;
I also tried
$("#viewButton").click(function () {
$(this).attr('toggle')=='ajaxModal';
});