Last active
January 4, 2016 03:09
-
-
Save mitsuruog/8560033 to your computer and use it in GitHub Desktop.
Bootstrap Modalにパラメータを渡す方法
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//3.0.3以降 | |
$myModal = $('#myModal').modal({}, { | |
person: 'mitsuruog' | |
}); | |
$myModal.on('show.bs.modal', function(e) { | |
var name = e.relatedTarget.person; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$myModal = $('#myModal').modal({ | |
person: 'mitsuruog' | |
}); | |
//2.3.1と3.0.0ではネームスベースが微妙に異なる | |
//2.3.1 | |
$myModal.on('show', function(e) { | |
var name = $(this).data('modal').options.person | |
}; | |
//3.0.0 | |
$myModal.on('show.bs.modal', function(e) { | |
var name = $(this).data('bs.modal').options.person | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment