The function I implemented is to add a label and add it to the label list without any additional efforts. For details, see the second line in. The style is obviously incorrect.
I repeatedly checked the html structure of the chrome console, which is the same. I have carefully compared IE and FF, but there is no difference. See
In the same html structure and style, the style displayed is very different. At the moment, there is no idea, like a headless fly. Simply copy the html in the console to notepad ++ for comparison. Html generated by js on the left and html in. aspx on the right
The reason for style differences may be that there is a lack of line breaks on the left. I added the line break "\ n" at the end of each line character, so that the style problem can be solved.
Copy codeThe Code is as follows:
Var html =
[
"<Li id = \" litem _ {0} \ "> \ n". format (catId ),
"<Div> \ n ",
"<Span class = \" checkbox \ "> <input type = \" checkbox \ "name = \" cbItem \ "value = \" {0 }\ "/> </ span> \ n ". format (catId ),
"<Span class = \" name \ "> {0} </span> \ n". format (catName ),
"<Span> <a href = \" javascript: void (0); \ "onclick = \" Blog. cat. edit ({0}); \ "> [edit] </a> <a href = \" javascript: void (0); \ "onclick = \" Blog. cat. delCat ({0}); \ "> [delete] </a> </span> \ n ". format (catId ),
"</Div> ",
"<Div style = \" display: none; \ "> \ n ",
"<Span> <input type = \" text \ "value = \" {0} \ "/> </span> \ n". format (catName ),
"<Span> <button type = \" button \ "class = \" button \ "onclick = \" Blog. cat. setCat ({0}); \ "> OK </button> </span> \ n ". format (catId ),
"<Span> <button type = \" button \ "class = \" button \ "onclick = \" Blog. cat. cancel ({0}); \ "> cancel </button> </span> \ n ". format (catId ),
"</Div> \ n ",
"</Li> \ n"
]. Join ("");
After a long time of thinking, I am so happy to solve a problem!
Author: qingliuyu