刷新div的问题
我有一个 div 如下: 一
var a = document.getElementById("xyz") ;
alert(a); //prints one
var b = document.getElementById("xyz").innerHTML ="two" ;
alert(b); //prints two
但是我的文本“二”没有反映在UI中,div文本如何没有反映在UI上。有什么方法可以强制刷新div。div不是普通的div。有一些jquery插件可以将 div 转换为锚点的工具提示。这样,当我将鼠标悬停在锚点上时,我可以看到工具
提示 编辑:这是标题如何附加到工具提示
<a alt="" class="tooltipcls"
style="background: transparent url(xyz.gif) bla bla bla;
title="#idofdiv" href="javascript:void(0);"
dojoAttachPoint="abc"
dojoAttachEvent="onmouseover:_populatetooltip"
></a>
<div dojoAttachPoint="aksabc1" id="idofdiv" style="display: none; position: absolute;">pop
up content here </div>
查看标题如何附加到 div。我运行他们的脚本,工具提示关联起来与锚
I have a div as follows:
one
var a = document.getElementById("xyz") ;
alert(a); //prints one
var b = document.getElementById("xyz").innerHTML ="two" ;
alert(b); //prints two
But my text "two" is not reflected in UI ,How div text is not getting reflected on UI.Is there any means by which i can forcefully refresh the div.The div is not a normal div .There is some jquery plugin that converts div into tooltip of a anchor.so that when i hover mouse over anchor i can see the tooltip
EDIT:Here is how title is attached to tooltip
<a alt="" class="tooltipcls"
style="background: transparent url(xyz.gif) bla bla bla;
title="#idofdiv" href="javascript:void(0);"
dojoAttachPoint="abc"
dojoAttachEvent="onmouseover:_populatetooltip"
></a>
<div dojoAttachPoint="aksabc1" id="idofdiv" style="display: none; position: absolute;">pop
up content here </div>
See how title is attached to a div.I run a their script and tool tip gets associated with the anchor
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
“B”和“I”必须大写。
Javascript 是区分大小写的语言。 Javascript函数一般使用小驼峰式来拼写,该方法称为getElementyById。
这是来自 W3C 学校:
The "B" and the "I" must be capitalized.
Javascript is a case-sensitive language. Javascript functions are generally spelled using lower camel case, the method is called getElementyById.
This is from W3C Schools:
您可以使用以下 Jquery 函数来更改 div 的内部文本
you can use following Jquery function to change inner text of div
JavaScript 区分大小写。它应该是
getElementById
。尽管如此,这可能不是您正在寻找的答案。编辑:问题是可能(因为您没有向我们展示完整的代码)您的工具提示插件正在抓取
div
的文本当你初始化插件时。所以,基本上,您可以再次调用该函数:同样,不是非常理想或其他什么。我们没有足够的代码可供使用。 :(
Javascript is case-sensitive. It should be
getElementById
. Although, that might not be the answer you're looking for.EDIT: The problem is probably (since you're not showing us your complete code) that your tooltips plugin is grabbing the
div
's text when you initialize the plugin. So, basically, you can call that function again:Again, not very optimal or anything. We don't have enough code to work with. :(