Hey there! I'm working on a form using Materialize and the collapsible component to display it. I want to include two tooltips for each category in the accordion: one to show the category name and another to display "Active" when an option is selected.
Here's my current code snippet:
function obtain() {
var selectCloud_and_or = $("#And_OrCloud").find("option:selected").text();
$("#cloud_AndOr").text(selectCloud_and_or);
}
$('select').change(obtain);
obtain();
.collapsible {
margin-left: 80px;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.0/css/materialize.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.0/js/materialize.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('.collapsible').collapsible();
});
</script>
<!-- select option -->
<script type="text/javascript">
$(document).ready(function() {
$('select').material_select();
});
$('select').material_select('destroy');
</script>
<!-- Tooltip -->
<script type="text/javascript">
$(document).ready(function() {
$('.tooltipped').tooltip({
delay: 50
});
});
</script>
<ul class="collapsible" data-collapsible="accordion">
<li>
<a class=" tooltipped" data-position="left" data-delay="50" data-tooltip="First">
<div class="collapsible-header"><i class="wi wi-cloudy"></i></i><span id="cloud_AndOr"></span><span class="clouds"></span></a>
</div>
<div class="collapsible-body">
<div class="row">
<div class="col s12 offset-s4">
<select class="and-or" id="And_OrCloud" name="a_o[]">
<option value="4" selected="selected">And</option>
<option value="5">Or</option>
</select>
</div>
</div>
</div>
</li>
I'm looking to have two tooltip elements: one that shows up when the user hovers over the accordion anywhere, and another that appears when hovering over the "and/or" option within the accordion header. Currently, I only have one tooltip implemented. How can I add the second one?