jQuery UI工具提示不包括“选择标记”不起作用
我正在使用jQueryUI工具提示小部件,它似乎在InternetExplorer中的select标记上断开。因此,我将从初始化中排除select标记。但是,这似乎不起作用,因为Internet Explorer中现在缺少所有增强的工具提示 这是我以前没有使用IE select标签的产品:jQuery UI工具提示不包括“选择标记”不起作用,jquery,jquery-ui,jquery-tooltip,jquery-ui-tooltip,Jquery,Jquery Ui,Jquery Tooltip,Jquery Ui Tooltip,我正在使用jQueryUI工具提示小部件,它似乎在InternetExplorer中的select标记上断开。因此,我将从初始化中排除select标记。但是,这似乎不起作用,因为Internet Explorer中现在缺少所有增强的工具提示 这是我以前没有使用IE select标签的产品: <script>j(document).tooltip();</script> 我也尝试了这段代码,但仍然不起作用。任何浏览器中都没有显示jQuery UI工具提示 <!--[
<script>j(document).tooltip();</script>
我也尝试了这段代码,但仍然不起作用。任何浏览器中都没有显示jQuery UI工具提示
<!--[if IE]>
<script>j('*').tooltip(); j('select').tooltip('disable');</script>
<![endif]-->
<!--[if !IE]>
<script>j(document).tooltip();</script>
<![endif]-->
更新: 我试过了,现在又回到了起点:
<script>j('*').tooltip();</script>
<!--[if IE]>
<script>j('select').tooltip('disable');</script>
<![endif]-->
j('*')。工具提示();
这很难看,但您可以在所有浏览器中设置选择器字符串,在IE中重写,然后实际调用它
<script>
var tooltipSelector = "*";
</script>
<!--[if IE]>
<script> tooltipSelector = ":not(select)"</script>
<![endif]-->
<script>
$(tooltipSelector).tooltip();
</script>
var tooltipSelector=“*”;
$(tooltipSelector).tooltip();
旁注:
$(document).not(“select”).tooltip()
选择文档,然后从集合中删除所有不是select
元素的元素(因为它只是一个文档,所以是所有元素),然后尝试在(现在为空)集合上创建工具提示。这是一个昂贵的禁止操作。在javascript解决方案中尝试使用条件标记:
var ie = (function(){
var undef,
v = 3,
div = document.createElement('div'),
all = div.getElementsByTagName('i');
while (
div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->',
all[0]
);
return v > 4 ? v : undef;
}());
j(function(){
if(!ie){
//ie will be undefined if a different browser than IE is used
//otherwise it will return the IE version
//handle IE here
}
else {
//handle the rest of the browsers here
}
});
var ie=(函数(){
var undef,
v=3,
div=document.createElement('div'),
all=div.getElementsByTagName('i');
当(
div.innerHTML=“”,
全部[0]
);
返回v>4?v:未定义;
}());
j(职能(){
如果(!ie){
//如果使用不同于ie的浏览器,ie将是未定义的
//否则它将返回IE版本
//在这里处理
}
否则{
//在这里处理其余的浏览器
}
});
您是否缺少DOM就绪处理程序
哪个浏览器将呈现我是否缺少什么?看起来在这个地方很好用IE9@BradM@Pete不,它在IE9或IE10中不起作用。你试过点击选择菜单吗?每当您尝试选择一个项目时,它就会关闭。
var ie = (function(){
var undef,
v = 3,
div = document.createElement('div'),
all = div.getElementsByTagName('i');
while (
div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->',
all[0]
);
return v > 4 ? v : undef;
}());
j(function(){
if(!ie){
//ie will be undefined if a different browser than IE is used
//otherwise it will return the IE version
//handle IE here
}
else {
//handle the rest of the browsers here
}
});
$(function(){
$("*").each(function(i, el){
$(el).attr("mytitle", $(el).attr("title")).removeAttr("title");
});
$("*").tooltip({
items: "[mytitle]:not([disabled])",
content: function() {
return $(this).attr("mytitle");
}
});
});