簡単な質問ですが、SOで満足のいく答えを見つけることができませんでした。
ブートストラップ アラートがある場合:
<div id='alert' class='alert alert-error hide'>Alert.</div>
Javascript または jQuery のいずれかを使用してテキストを制御したいのですが、この問題に対するこの解決策を見ただけですが、それほど複雑にする必要がありますか? 本当に?
簡単な質問ですが、SOで満足のいく答えを見つけることができませんでした。
ブートストラップ アラートがある場合:
<div id='alert' class='alert alert-error hide'>Alert.</div>
Javascript または jQuery のいずれかを使用してテキストを制御したいのですが、この問題に対するこの解決策を見ただけですが、それほど複雑にする必要がありますか? 本当に?
<input type = "button" id = "clickme" value="Click me!"/>
<div id = "alert_placeholder"></div>
<script>
bootstrap_alert = function() {}
bootstrap_alert.warning = function(message) {
$('#alert_placeholder').html('<div class="alert"><a class="close" data-dismiss="alert">×</a><span>'+message+'</span></div>')
}
$('#clickme').on('click', function() {
bootstrap_alert.warning('Your text goes here');
});
</script>