Bootstrap 3.0 - Create Bootstrap alert with jQuery

by Joe Cisneros

HTML

<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
<!-- Post Info -->
<div style='position:fixed;bottom:0;left:0;    
            background:lightgray;width:100%;'>
    StackOverflow Question: 
    <a href='http://stackoverflow.com/q/19867533/1366033' target="_blank">
        Create Bootstrap alert in JQuery
    </a>
<div>

JavaScript

$("body").prepend('<div id="usernameError" class="alert alert-danger hidden"><strong>Error</strong> Username not set. Please try refreshing the page. Contact <a href="http://support/portal" target="_blank">Helpdesk</a> if it continues to happen.</div>');

$(document).ready(function() {
	$("#usernameError").show();
)};