Edward Palen Edward Palen - 1 year ago 121
PHP Question

Is this the right way to add tooltips in laravel?

By working with laravel we can add tooltips twitter-bootstrap easily, according to my knowledge.

Add the CDN in the app.blade.php file and apply functions on labels to display the message correctly.

Simple example:

app.blade.php file

<!-- Bootstrap CSS CDN-->
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">

<!-- Place the end of the tag - jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
$( document ).ready(function() {
$('[data-toggle="tooltip"]').tooltip({'placement': 'top'});


If we want to display a message on a button we can do this.

<a class="btn btn-info" href="#" data-toggle="tooltip" rel="tooltip" data-placement="top" title="Detalle usuario"> <i class="material-icons">aspect_ratio</i> </a>

Answer Source

Since you've already set the data-placement to top inline style, the .tooltip({'placement': 'top'}) wont be necessary. All else, yes, that's how you properly initialize a bootstrap tooltip regardless of php framework used... – From Valkyrurr.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download