I'm testing Bootstrap and I have a silly problem.
When I use tooltips on several buttons (in the same row) at the begining all the buttons are separated by several pixels.
When the tooltip appears then the space between the buttons dissapears.
My code:
<button type="button" class="btn btn-default" data-toggle="tooltip" id="btn01"
data-placement="top" title="Tooltip on top">Button with tooltip</button>
<button type="button" class="btn btn-default" data-toggle="tooltip" id="btn02"
data-placement="left" title="Tooltip on left">Button with tooltip</button>
<button type="button" class="btn btn-default" data-toggle="tooltip" id="btn03"
data-placement="right" title="Tooltip on right">Button with tooltip</button>
<button type="button" class="btn btn-default" data-toggle="tooltip" id="btn04"
data-placement="bottom" title="Tooltip on bottom">Button with tooltip</button>
<script src="http://code.jquery.com/jquery.js"></script>
<script src="js/bootstrap.js"></script>
<script type="text/javascript">
$('document').ready(function() {
$('#btn01').tooltip();
$('#btn02').tooltip();
$('#btn03').tooltip();
$('#btn04').tooltip();
});
</script>
Problem already solved adding inside the button tags ...
data-container="body"
By the way ... I still know nothing about JS. I'm learning.
So I understand I could add for example the class clsTooltip to the 4 buttons and then ... ¿use this ...?
$('document').ready(function() {
$('.clsTooltip').tooltip();
});
Thanks a lot!!
Related
jquery-confirm version: v3.3.0 git:craftpip/jquery-confirm
jsfiddle for tests https://jsfiddle.net/bdtx2ub2/
<div class="jconfirm-buttons">
<button type="button" class="btn btn-info btn-block">Update</button>
<button type="button" class="btn btn-danger btn-block">Delete</button>
<button type="button" class="btn btn-default btn-block">Cancel</button>
</div>
Can you help me... how can I add to div with class jconfirm-buttons my class? Is there are any solution like columnClass or btnClass for this div?
I want to justify my buttons in this div by adding bootstrap class btn-block to make div justified
<div class="jconfirm-buttons btn-block">
<button type="button" class="btn btn-info btn-block">Update</button>
<button type="button" class="btn btn-danger btn-block">Delete</button>
<button type="button" class="btn btn-default btn-block">Cancel</button>
</div>
Before
What I want to do
How can I do this? Is there are any solution without javascript? Or how can I do it with js (thinking that I can justify them binding this javascript on event "onOpen")?
Here jsfiddle link. This solution not good but still work.
onOpenBefore:function(){
this.buttons.close.el[0].parentNode.className+=" btn-block";
},
In this plunk I have an Angular UI Datepicker that uses a template. I need to change the colors of the "Today", "Clear" and "Close" buttons but changing them in popup.html doesn't work. It should show gray, orange and blue buttons.
I changed from
<li ng-if="showButtonBar" class="uib-button-bar">
<span class="btn-group pull-left">
<button type="button" class="btn btn-sm btn-info uib-datepicker-current" ng-click="select('today', $event)" ng-disabled="isDisabled('today')">{{ getText('current') }}</button>
<button type="button" class="btn btn-sm btn-danger uib-clear" ng-click="select(null, $event)">{{ getText('clear') }}</button>
</span>
<button type="button" class="btn btn-sm btn-success pull-right uib-close" ng-click="close($event)">{{ getText('close') }}</button>
</li>
to
<li ng-if="showButtonBar" class="uib-button-bar">
<span class="btn-group pull-left">
<button type="button" class="btn btn-sm btn-default uib-datepicker-current" ng-click="select('today', $event)" ng-disabled="isDisabled('today')">{{ getText('current') }}</button>
<button type="button" class="btn btn-sm btn-warning uib-clear" ng-click="select(null, $event)">{{ getText('clear') }}</button>
</span>
<button type="button" class="btn btn-sm btn-primary pull-right uib-close" ng-click="close($event)">{{ getText('close') }}</button>
</li>
Note that I changed the button class names to change the color, but when I inspect in the browser, the datepicker is still using the old classes. How to fix this?
To set a custom popup template use datepicker-popup-template-url attribute, for example:
<input datepicker-popup-template-url="popup.html" type="text" class="form-control" is-open="true" ng-model="dt" uib-datepicker-popup="MM-dd-yyyy"
datepicker-options="dateOptions" close-text="Close" popup-placement="bottom-left" on-open-focus="false" />
Demo
I am trying to use bootstraps popover button with html inside it, but I get Unexpected token errors when building the JSX.
Here is what I want to do in JSX:
<button type="button" className="btn btn-secondary" data-container="body"
data-toggle="popover" data-placement="bottom"
data-content="<button type="button" className="btn btn-danger pull-xs-left" data-dismiss="modal">Delete</button>">
data-html="true"
Popover on bottom
</button>
But react doesn't like building data-content:
data-content="<button type="button" className="btn btn-danger pull-xs-left"
Throws: Unexpected token
> 1265 | data-content={"<button type="button" className="btn btn-danger pull-xs-left" data-dismiss="modal">Delete</button>"}>
| ^
How do I get around this? I'd like to not use jquery preferably.
There is nested ' " ',you need to use this way
<button type="button" className="btn btn-secondary" data-container="body"
data-toggle="popover" data-placement="bottom"
data-content='<button type="button" className="btn btn-danger pull-xs-left" data-dismiss="modal">Delete</button>'
data-html="true"
Popover on bottom
I have buttons:
<button type="button" id="add_argument_button" class="btn btn-default disabled">
<span class="fa fa-plus"></span>
</button>
<button type="button" id="remove_class" onclick="remove_disabled();">
remove
</button>
And js function:
function remove_disabled(){
$("#add_argument_button").removeClass("disabled);
}
It works and when I click on second button the first button is not de facto disabled and I can click on it. But view of button and cursor stay as disabled. I think, that I need reload first button. Why we can resolve this problem?
You are missing double quotes at the end of your removeClass statement.
$("#add_argument_button").removeClass("disabled");
Maybe you need to disable the first button?
function remove_disabled(){
$("#add_argument_button").removeClass('disabled');
$("#add_argument_button").prop("disabled", true);
}
<!DOCTYPE html>
<html>
<head>
<style>
</style>
<script src="/scripts/snippet-javascript-console.min.js?v=1"></script>
</head>
<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button type="button" id="add_argument_button" class="btn btn-default disabled">
<span class="fa fa-plus"></span>
</button>
<button type="button" id="remove_class" onclick="remove_disabled();">
remove
</button>
<script type="text/javascript">
</script>
</body>
</html>
Try this code, Its working
<body>
<button type="button" id="add_argument_button" class="btn btn-default disabled">
<span class="fa fa-plus"></span>
</button>
<button type="button" id="remove_class">
remove
</button>
<div id="logbefore"></div>
<div id="logafter"></div>
</body>
// Add your javascript here
$(function() {
$("#logbefore").text($("#add_argument_button").attr('class'));
$("#add_argument_button").removeClass("disabled");
$("#logafter").text($("#add_argument_button").attr('class'));
});
Demo
I know we can pass HTML content in Bootstrap Popover by JavaScript but just wondering if there is a way to pass content through data-content without using JavaScript something like:
var ecoloInfoTable = "<strong>Yes This is Data</strong>";
var data = '<button type="button" class="btn btn-success btn-xs" data-container="body" data-toggle="popover" data-placement="top" data-content="'+ecoloInfoTable+'"> <i class="fa fa-question"></i></button>';
$(".container").append(data);
$("[data-toggle=popover]").popover();
Thanks
There is an option that enables HTML content in popover. This option can be passed via JavaScript e.g.
$("[data-toggle=popover]").popover({ html: true });
or in HTML (which is what you are asking) e.g.
<div class="container">
<button type="button" class="btn btn-success btn-xs" data-container="body" data-toggle="popover" data-placement="top" data-content="In this title I have <b>bold</b> text" data-html="true">
<i class="fa fa-question"></i>
</button>
</div>
<script>
// Initializing popover without options
$("[data-toggle=popover]").popover();
</script>
As you can see in this demo, you can have HTML inside the title attribute and it an be shown properly in the popover.