Click here to Skip to main content
15,901,122 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI all,

I am using the following code in my application


C#
if (checkbox.value == 0)
        {
        var panel = document.getElementById('ROWID');
        panel.style.visibility = "visible";
        var label= document.getElementById('labelid');
        label.innerText = "Message to be displayed!";
        lblf.style.color = "RED";
        lblf.style.visibility = "visible";
        }



Here I have problem that only panel is getting visible but than the label is not getting visible and this problem is only happening in FIREFOX while in all other problems both are getting visible...

Can any body give me idea that how this problem could be solved.

I have also tried using style.display but still getting same issue.
Posted

1 solution

Firefox uses W3C standard Node::textContent, but its behavior differs "slightly" from that of MSHTML's proprietary innerText

So, change following line
label.innerText = "Message to be displayed!";
To
if(label.textContent && (typeof (label.textContent) != "undefined") )
   label.textContent = "Message to be displayed!";
else label.innerText = "Message to be displayed!"; 


Regards,
Niral Soni
 
Share this answer
 
Comments
VICK 23-Aug-13 8:06am    
Tried but still the same... I am novice to JavaScript but as far as I understand your code.. it checks the textcontent of the lable and its type and if that is undefined or defined show the label anyway....

am i right???

Further let me tell you one thing that I have tried using FireFox Browser's Debugger and found that Browser gets the Label and also in the properties its getting the text as well along with visibility property and colour.

SO problem is not that might be Text is coming undefined as Your solution points..


Any other idea???



EDIT:::: After replacing with your code... now innerText and textContent both are showing blank in debugger...:(

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900