次のコードでモーダルが表示されないのはなぜですか?
ボタン:
<td><button type="button" id="display" class="btn btn-warning btn-small">Yes »</button> </td>
Javascript:
<script type="text/javascript">
$('#display').click(function(e)
{
var displaydatasharingModal = $('#displaydatasharingModal')
var emails = <?php echo json_encode($emails) ?>;
//var current_id = $(this).data('id');
//$(".modal-body #current_id").val(current_id);
console.log(emails);
alert("yes!");
// function to get the options
function getPropsAsString(emails) {
var props = [];
for (prop in emails) {
var val = emails[prop];
// Filter out blank at beginning and "Add New"
//if (val === " " || val === "Add New")
// continue; // skip it
props.push(prop);
}
// Sort them (what the hell)
props.sort();
return props.join(", ");
}
$('#modal-body span2').html(getPropsAsString(emails));
displaydatasharingModal.modal('show');
}
</script>
モーダル:
<!-- modal (Display Data Sharing) -->
<div class="modal small hide fade" id="displaydatasharingModal" tabindex="-1" role="dialog" aria-labelledby="displaydatasharingModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="displaydatasharingModalLabel">Data shared with:</h3>
</div>
<div class="modal-body">
<p> Current access emails are: <p><span2></span2></p></p>
<p>some content</p>
<input type="text" name="current_id" id="current_id" value=""/>
</div>
<div class="modal-footer">
</div>
</div>
モーダルには奇妙なものがたくさんあることはわかっていますが、すぐに取り組みたいと思っています。しかし、私の問題は非常に基本的なものだと思います。ボタンをクリックしてもモーダルが表示されないのはなぜですか?! 私はこれを、以前に書かれたコード作品と並行して行っています。このコンテキストで機能しない理由は不可解です。しばらくの間、これで髪を引き裂いています。助けて天才!