I was coding this morning a simple contact manager, and I found that I can't change the style of the text in JavaScript ! the Problem :
function addcontact() {
var ul = document.getElementById("list");
var firstname = document.getElementById("input_firstname");
var lastname = document.getElementById("input_lastname");
var li = document.createElement("li");
li.setAttribute('id',firstname.value);
li.appendChild(document.createTextNode("Firstname:" + firstname.value + ", Lastname: " + lastname.value ));
ul.appendChild(li);
}
li.appendChild(document.createTextNode("Firstname:" + firstname.value + ", Lastname: " + lastname.value ));
In this line I can't change the style of "Firstname: " . I tried to add some tags but nothing happened!
How can i solve this problem?