开发者

problem with refreshing 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 norma开发者_高级运维l 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


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:

document.getElementById('xyz').innerHTML = "two";
$('.tooltip').tooltip(); // The code that initializes your plugin

Again, not very optimal or anything. We don't have enough code to work with. :(


you can use following Jquery function to change inner text of div

  $("div#xyz").html('two');


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:

A function named "myfunction" is not the same as "myFunction" and a variable named "myVar" is not the same as "myvar".

JavaScript is case sensitive - therefore watch your capitalization closely when you create or call variables, objects and functions.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜