简体   繁体   中英

Labels generated from javascript are not working in mozilla firefox

I am creating labels using javascript in my work.It is working fine in google chrome but its not working in Mozilla firefox. And the version of firefox is 4.0 which is latest one..bu still its not working..what is the solution for this? Here is example code...Like this there are so many situations where i create labels in js.But firefox is not supprorting..why? Help me pls...Example code is:-

var placeHereHeader=document.getElementById("placeLabel");
var HeadLabel=document.createElement("label");
HeadLabel.setAttribute("id","LabelHeader");
placeHereHeader.appendChild(HeadLabel);

This is an old question, but never answered.

http://jsfiddle.net/bL6sf/ shows it indeed works, but I have the newer version than Firefox 4.0.

Maybe you didn't see the label because you didn't put any text or html inside it?

var placeHereHeader=document.getElementById("placeLabel");
var HeadLabel=document.createElement("label");
HeadLabel.innerHTML = "My kickass label";
HeadLabel.setAttribute("id","LabelHeader");
placeHereHeader.appendChild(HeadLabel);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM