我希望你没事。我有一个问题,首先我要展示一个代码来更好地解释myselft。
function Tooltip () {
var values = $("#And_Or").val();
if (values == 4) {
$('body').on("mouseover",'.dropdown-content', function(){
$("#tool-new").tooltip("hide");
});
}
else if (values == 5) {
alert("here I have to put the code to show the tooltip again");
}
}
$('select').change (Tooltip);
Tooltip();
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/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.100.2/js/materialize.min.js"></script>
<script type="text/javascript">
$(document).ready (function() {
$('select').material_select();
});
$('select').material_select('destroy');
$('.tooltipped').tooltip({delay: 50});
</script>
<div class="col s12 offset-s4">
<a id="tool-new" class="tooltipped" data-tooltip="Please select more than one category" data-position="right" data-delay="120">
<select class="and-or" id="And_Or" name="a_o[]">
<option value="4" selected="selected">And</option>
<option value="5">Or</option>
</select>
</a>
我只想知道:如果select的值是4或5,如何显示和隐藏工具提示?我正在使用框架Materializecss