Answer the question
In order to leave comments, you need to log in
How to properly insert elements in JavaScript?
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Пример</title>
</head>
<body>
<div class="test">Тест</div>
</body>
</html>
var opt = {
'css' : '<style type="text/css">.test{color:red;}</style>',
'html' : '<div>Привет мир</div>'
};
$(head).append(opt.css);
$(body).append(opt.html);
var head = document.getElementsByTagName('head')[0];
head.innerHTML += opt.css;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question