Twitter Bootstrap alert (notification) dynamically change text

javascript, jquery, twitter-bootstrap

Solution

Referenced the solution and now came up with this:

HTML:

<div id='alert' class='hide'></div>

Javascript:

function showAlert(message) {
      $('#alert').html("<div class='alert alert-error'>"+message+"</div>");
      $('#alert').show();
    }
showAlert('variable');

Working jsfiddle.

Problem

Simple question, but I didn't succeed finding a satisfactory answer on SO. When I have a bootstrap alert: ``` <div id='alert' class='alert alert-error hide'>Alert.</div> ``` I want the text to be controlled using either Javascript of by jQuery, I just looked at this solution to this problem, but does it have to be so complicated? Really?

Original source

Related problems