Reputation: 373
I have included this in the html
<!-- Bootstrap UI stuff -->
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css">
<!-- Latest compiled and minified JavaScript -->
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
and then in my javascript I have tried making the buttons nice by going
$('<button type="button" class="btn btn-primary">',{
id:"opener-add-"+tableName,
html:"Add"
}).appendTo("#form-"+tableName);
What I end up with is a blue button but the "Add" is missing (it was the same with anormal button, I lost the text).
Upvotes: 0
Views: 74
Reputation: 3385
Tryt this,
$('<button type="button" id="opener-add-'+tableName+'" class="btn btn-primary">Add</button>').appendTo("#form-"+tableName);
Upvotes: 0
Reputation: 36511
HTML and text are not really DOM attributes (you are in effect running: document.body.setAttribute('html', 'Add')
), you have to set them using the text
or html
methods:
$('<button type="button" class="btn btn-primary">',{
id:"opener-add-"+tableName,
}).text('Add').appendTo("#form-"+tableName);
Upvotes: 1